Mount the hard disk under linux to solve the problem that Aliyun disappears after restarting after mounting

The complete Alibaba Cloud method of mounting a data disk is as follows:

1. After starting Alibaba Cloud, check how many hard disks there are: (only display the overview, not the partition status)

fdisk -l|grep Disk

2. View the hard disk partition

fdisk -l

If there is a prompt: disk /dev/vdb doesn t contain a valid partition table, it means that the data disk has not been partitioned and mounted

3. Partition (this step is generally not used)

Switch to the root account and enter the root directory;

Command “fdisk /dev/vdb”; then follow the prompts to partition

According to the prompt, enter “n”, “p”, “1” in turn, press Enter twice, and “wq”, the partitioning starts and will be completed soon.

Command “mkfs.ext3 /dev/vdb” to format the partition, ext3 is the format, you can according to your own situation.

4. Mount

“mkdir /www” to create a mount directory

The command “mount /dev/vdb /www” mounts the partition xvdb1 to the data0 directory.

(Note that you must mount the data first and then put the data. If you put the data first and then mount it, the data will be lost. But don’t worry, if you encounter this situation, the data will come back after you cancel the mount)

5. Write the information of the mounted hard disk to the /etc/fstab file, otherwise the mount will be gone after restarting the system, then it must be manually mounted after each restart. (Alibaba Cloud does not introduce this step), the method is as follows:

echo '/dev/vdb /www

The post Mounting Hard Disks under Linux, Solving the Problem of Rebooting and Disappearing after Alibaba Cloud Mounted first appeared on Lenix Blog .

This article is reprinted from https://blog.p2hp.com/archives/8849
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment