1, first we use virtual machine simulation server to join a new hard disk, hard disk capacity into 5GB hard disk.
2, first we want to partition it, we know from above that need to format the partition is the second hard disk.
3, Input n Enter is the new partition, p is the primary partition (only 4 primary partitions can be established), E is the extended partition, and then in the extended partition to establish logical partition. Let's start by saying how the primary partition is built.
4, the following means that the establishment of the main partition (input P return), 1-4 is that the main partition number is a few, is generally directly enter. "First Sector" represents the initial magnetic column area, you can choose 2048-20971519, the default is 2048, directly enter. Here is how much space to this partition, as shown below, after the direct P return to view (here does not enter the W return will not be saved), and so on can establish 4 partitions. After the operation is completed, remember to enter W return to save exit.
5, after the completion of the need for formatting. Mkfs.ext4/dev/sdb1
6, the completion of the area can not be used directly, you need to set up a directory to hang it up. MOUNT/DEV/SDB1/DATA1, if you need to format the current partition, you need to uninstall before you can format it.
7, the above just hang in, restart will be invalid. We need to set the restart time automatically hang on.
Let's talk about the parameters of auto-hanging on the boot.
First column: Hard disk partition (Dev front not plus/) second column: Hang at the point (which directory you want to mount the partition to) column three: ext4 (file system type, such as NTFS and FAT32 on Windows, etc.) column Fourth: defaults (default defaults is generally not available) column fourth: Can be the dump backup command (default 0 on the line) 0 means do not do dump backup 1 Represents a daily dump Operation 2 represents an indefinite date of the dump Operation Fifth Column: whether to verify the sector, the system will default to FSCK check whether our system is complete (clean) 0 do not test 1 First Test (general root selection) 2 1 level inspection after completion
Attention:
The following this power-up error is likely to occur, because the boot automatically hangs in the failure, will start the failure, you need to enter the root password directly, go into the/etc/fstab inside the wrong to hang in the command to delete, save the restart can automatically boot.
8. Boot Check
9, the following we talk about the use of extended partitions (in case your company is not short of hard disk, partition and very personality how to do), the biggest difference is the time of the input of the E-enter. The equivalent of an extended partition on Windows (not an actual partition to work with, and the need to continue partitioning), the ID column becomes a 5, which is completely different from the primary partition above.
10, we divide a logical partition, is supposed to divide a partition should be/dev/sdb3 ah how is/SDB5, notice in front we said the main partition only 1-4 number, if here we see the number is 5 or larger partition, is the logical partition. (after the extended partition is deleted, the following logical partition will no longer exist, use it cautiously.) )
Let's do an exercise. The following partition has 2 primary partitions, SDB1 and SDB3,SDB2 are extended partitions, SDB5 and SDB6 are logical partitions.
11, there are students said, here is the end, we directly follow the main partition of the use of MKFS.EXT4 format partition on the line, no, here with the main partition there is a discrepancy, not you try, the direct error shown.
As follows, execute the partprobe command (synchronizing the new partition table changes to the operating system)
There must be a classmate sleepy did not want to understand, directly to the SDB2 extended partition as normal partition format, that Ken di you want to report the following error, above we do is logical partition only SDB5 and SDB6.
SDB5 and SDB6 are formatted smoothly.
11. Mount Test
12, automatic hanging in is not here to boil down, before we talked about.
If you want to hang it on a cloud server,
If you need to mount the disk automatically when the cloud server system starts, you cannot use the method of specifying/DEV/SDB5 directly in/etc/fstab, because the sequential encoding of devices in the cloud may change during the shutdown or opening of the cloud server, for example/DEV/SDB5 may become/dev/ Sdb2. It is recommended to use UUID to configure automatic mounting of data disks.
Description: The disk's UUID (universally unique identifier) is the unique identification string provided by the Linux system for the storage device.
Blkid (see UUID for each partition)
2. Edit/etc/fstab/by VI and add a line at the end
Uuid=944bfb24-461c-445a-932f-4628119c9106/data5 EXT4 Defaults 0 0
Linux HDD Management fdisk