Disk partition boot up and mount automatically

Source: Internet
Author: User

Partitioning requirements: Add a 10G new hard drive to an existing operating system using a virtual machine. The device name is/ETC/SDB and you need to divide this disk into three zones, 3G respectively.

The first partition is used as a ext3 format for Linux and is mounted in the/data1 directory.

The second partition is the FAT32 format that the Windows system can access and is mounted under the/FTP1 directory.

The third partition is a swap partition for memory as swap memory expansion. The above partitions need to be mounted automatically mount.

How to: Format the last mounted partition after partitioning the hard disk first

Partitioning: First step to see if the/dev directory to add a good sdb, make sure that the Fdisk tool is added after the partition, the command below FDISK/DEV/SDB into the partition interface, you can use the P command to view the hard disk partition. The partition information is not displayed because it is not yet divided.

The second step using the N command to add a new partition system prompts you to add an extended partition (extended) or a primary partition (primary). Because there are only four primary partitions in a single disk, it is not easy to extend the partition in the future by selecting e-Extended partitions. Because it is a new disk, you can select the Extended Partition volume label as SDB1 and the entire disk as an extended partition. Partitioning logical partitions in extended partition SDB1, dividing three 3G logical partitions

The third step is to modify the partition format of three logical partitions, because the first partition SDB5 default to EXT3 partition and therefore does not need to be modified. Use instruction t to select the partition format to divide the second logical partition SDB6 into FAT32 types. FAT32 divides the third partition into the swap type after the code in the partition type table is B, and the T 7 code is 82 finally uses the P instruction to confirm the result and then saves the exit with W.

Format: Because it is centos5 we can use the Partprobe command to SDB Disk partition table refresh, otherwise cannot be formatted. If Redhat6 cancels this command, the system needs to be restarted.

Partprobe/dev/sdb

We can then use the fdisk-l command to view the partition results of the system's hard disk to verify that the partition is successful. Once confirmed, we can use the command to format the three partitions separately.

Mkfs.ext3/dev/sdb5

Mkfs.vfat/dev/sdb6

Mkswap/dev/sdb7

Mount: Mounts can be used to mount commands such as

Mount/dev/sdb5/data1

Mount/dev/sdb6/ftp1

Swapon/dev/sdb7

With the Df-h command and the free-m command, we can view the disk and swap memory mounts.

However, if the system reboots the mount will fail. If you want to implement power-on mount we need to modify the boot file with the VIM editor/etc/fstab

Finally, use the mount-a command to refresh the mount information. Then reboot the system to see the effect

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.