Note:
1, mount the hard disk should be installed in other software or environment before operation;
2, before mounting, if there is data, please pay attention to backup;
3, the name of the partition mentioned in this article, the hard disk name for reference only, the actual due to environmental differences may be different.
The first step is to use the "fdisk-l" command to view the hard drive :
As can be seen from the above figure, we have 2 hard drives, the second hard disk is /dev/vdb1 , the size of about 96G, has been formatted and partitioned well.
Note: If the prompt "disk/dev/vdb doesn ' t contain a valid partition table" indicates that the hard drive has not been partitioned, you need to format the hard disk and format it as a EXT3 log file system, and the command is: " MKFS.EXT3/DEV/VDB1". Step Two, mount the hard drive
Before mounting, create a mount directory on the server that needs to be mounted or use a directory such as home that already exists.
Mount the disk to the home directory, mount the command: "mount/dev/vdb1/home"
Here is mount to home, the back of the directory you can change yourself, note that the mount may delete the original file.
How do I create a new directory?
You can create a myhome directory under the root directory.
By default, the command to jump to the root directory is: CD.
Create Directory command as: mkdir/myhome
After the mount, enter "df-h" To view the Mount status as follows:
You can see that/DEV/VDB1 was successfully mounted to the/home directory. The third step, set the boot automatically mounted hard disk :
Enter the following command in SSH (note that the/home is modified to the directory you are actually mounting):
echo "/dev/vdb1/home ext3 defaults 1 2" >>/etc/fstab
After modifying the/etc/fstab file, run the mount-a command to verify that the configuration is correct, and if there are no prompts after execution, the instructions are successful.