Linux disk partition, format, mount, uninstall full explanation

Source: Internet
Author: User

1. All Documents

The Linux system has a concept: "Everything is File", so the computer's hardware in Linux is also in the form of "file" in the/dev directory.

The figure is part of the/dev directory in the CentOS 6.5 system. Different computers display a similar content. For example, the CD-ROM corresponding file is/dev/cdrom,cpu corresponding file is/dev/cpu. And the hard drive corresponds to the/dev/sd*. The first hard drive is/DEV/SDA, and the second disk is/dev/sdb. However, a disk is usually divided into multiple partitions, so the partition is followed by the number of partitions on the disk file. Refer to the example in the table below.

partition

1 partitions

/dev/sda1

first hard drive 2 partitions

/dev/sda2

2 partitions

/dev/sdb2

2. Create partition 2.1 Use the Cfdisk command to create a partition.  This example uses the/DEV/SDB disk in the demo. Start using the Cfdisk command to enter the Cfdisk interface. cfdisk/dev/sdb[new]--[primary]--manually enter the partition capacity in M. Enter to create the success. Finally select [Write], enter "Yes", and write the configuration to disk. Select [Quit] to exit Cfdisk.   ps:cfdisk command temporarily does not support GPT partition format2.2 Format Partition MKFS MKFS-Supports ext2, ext3 (log), Ext4, VFAT, Msdos, JFS, ReiserFS, 1:mkfs-t <fstype> <partition> Example: #mkfs -T EXT3/DEV/HDA1 usage 2:mkfs.<fstype> <partition> Example: #mkfs. vfat/dev/hda2 This example is MKFS.EXT4/DEV/SDB1PS: After formatting the partition, you can use the E2label command to add a volume label to the partition E2label the partition path volume label name 3. Mount partition hint: Use the df-h command to view the mounted partitions on the current system 3.1 manual mount partition mount-t/dev/sdb1/mnt/sdb1 unload partition umount command format: umount [option] special | When node uses Umount to unload a partition, you can specify a mount point, or you can specify the mount path, such as this example, to unload the mount of the SDB1 partition, use UMOUNT/DEV/SDB1 or UMOUNT/MNT/SDB1 PS:when using Umount uninstallation, if the device path is specified, Umount will unload the last mounted mount point in the Mount order. 3.2 Automatic mount partition the Linux system automatically mounts partitions from the/etc/fstab file when it is started.  The figure is an example of a fstab file. Fstab, each configuration information is divided into a fixed 6-part [1]: partition path, or uuid[2]: Fs_file-This field describes the directory point that you want the file system to load, which is none for swap devices, and 40来 to represent spaces for loading directory names that contain spaces. [3]: Fs_type-Defines the file system on the device, generally common file types are Ext4 (common file types for Linux devices), VFAT (FAT32 format for Windows systems), NTFS, isoArray600, and so on. You can use auto in case of uncertainty. [4]: fs_options-Specifies that the file system that loads the device is a specific parameter option that needs to be used, and that multiple parameters are separated by commas. For most systems, "defaults" can be used to meet the needs. Not much to say. [5]: Fs_dump-This option is used by the "Dump" command to check how fast a file system should dump and set the field 0[6] If no dump is required: Fs_pass-This field is used by the fsck command to determine the sequence of file systems that need to be scanned at startup, the root filesystem "/" pair should be

The value of the segment should be 1, and the other file system should be 2. Set this field to 0 if the file system does not need to be scanned at boot time

in this example, the configuration for adding the SDB1 partition to the Fstab file automatically mounts as follows:

/DEV/SDB1/MNT/SDB1 EXT4 Defaults 0 2

PS: Other accounts (such as ORAC, MySQL) may encounter insufficient permissions when using this new partition, use the following command to resolvechmod 777/mnt/sdb1

Linux disk partitioning, formatting, mount, uninstall full details

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.