Disk mounting on Linux
Linux disk mounting
I. Disk partitioning
Enter the fdisk-l command on the terminal to view the partition information of the entire system. We can see that a 32 GB/dev/vdb disk is not mounted.
Enter fdisk/dev/vdb for partitioning
As shown in, enter m in Command () to view the Command introduction.
Enter n to add a partition. Here, 32 disks are all divided into one partition. You can also enter the partition size you want. If you enter directly, the default value is all disk space.
Partion ...... The number in (1-4) is the partition number, and you can select it as needed.
In this case, enter p to view the partition you just created.
Enter w to save and exit. If q is input, do not save and exit.
The partition is valid only after the machine is restarted.
Ii. disk formatting
Enter mke2fs-j-L "vbird_logical"-B 2048-I 8192/dev/vdb1 on the terminal to format the partition.
The format is ext3. If j is not specified, the format is ext3.
Iii. Mount
If an important file exists in the mounted directory, first move the file to another directory and then mount the disk partition to this directory (mounted to/var)
Mount command: mount/dev/vdb1/var
After mounting, move the original data under/var back.
Delete the mount: umount/dev/vdb1
Note: If you want to mount a disk effectively, you must set the Mounting Mode at startup. Therefore, you must delete the Mounting Mode first, but this mounting mode is required, it should be in this way that the files under the original/var will be moved to the partition disk. After the mounting is set up, the machine can be restarted normally; otherwise, a system fault will occur, if a non-system file directory is mounted, the file will not be lost. Otherwise, the original file under the mounted directory will not be found.
Iv. Set boot mounting
Enter nano/etc/fstab on the terminal
Write
/Dev/vdb1 (Mount partition)/var (this is the directory to be mounted) ext3 defaults 1 2
Press ctrl + x and then select yes to exit. Restart the host.
Note: One disk partition can be attached to multiple directories.