Linux VPS Mount Hard drive command details

Source: Internet
Author: User
Tags create directory vps

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.

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.