Disk mounting on Linux

Source: Internet
Author: User

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.

 

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.