Linux commands-Add new hard disk, partition and mount [go]

Source: Internet
Author: User

Transferred from: http://blog.chinaunix.net/uid-25829053-id-3067619.html

Mount the new hard drive and enter the FDISK-L command to view the current disk information (the addition of new hard disks in Linux, the non-mounted file system df is not visible)

FDISK-L viewing Current disk information

You can see a second hard disk with a/DEV/VDB in addition to the current first hard drive, and then partition it with FDISK/DEV/VDB

Fdisk/dev/vdb to Partition

After entering the FDISK command,

Enter h to see Help for the command, partition by n

Input e is divided into logical partitions, the input p is divided into primary partition, we want to divide the disk into primary partition is the input p,

Enter the primary partition here as the primary partition, because it is a new disk we enter one of the first primary partitions

First cylinder is the number of starting disks to select the partition, which can be customized or not, the default is 1, if no special need is strongly recommended to choose the default, that is, one partition (directly press ENTER)

Next is to define the size of the partition, if the default (press ENTER) is the use of all available storage amount, or can be the number of M or m units ending (uppercase M is large B meaning, if the input 1M is actually X8 8m space), here we first divided into a 1G of space, so the input +1024m

Then enter W to write the partition, waiting for the end to be

Then enter Fdisk-l to see one of the partitions we just divided.

After the use of mkfs-t ext4-c/dev/vdb1 format, if there are multiple partitions can change VDB1 to VDB2, vdb3 ... And so on, you can see the name of each partition with Fdisk-l

Mkfs-t ext4-c/DEV/VDB1

The blue part is to write the hard disk label, if you do not want the label can be directly press ENTER, now partitioned well we use Mount mount the partition can be used, here I attach it to the MNT directory, you can also build a directory to mount.

Mount command using: http://www.cnblogs.com/qiyebao/p/4331290.html

mkdir//dev/vdb1/data Mount
Mount View Mount Information

To see if the partition size is the same as the predetermined one, use the df-th command to look at the current mounted partition and size, and see the partition we just divided.

Df-th

If you want to automatically mount the partition each time the system restarts can modify the/etc/fstab file, in the last Add a section/dev/sdb1/www ext3 defaults 1 2 (format description:/DEV/SDB1 represents which partition ext3 is the format of the partition Def Aults is the parameters to set when mounting (read-only, read-write, enable quota, etc.), input defaults include parameters (rw, dev, exec, auto, nouser, async), 1 is the use of dump whether to record, 0 is not. 2 is the boot check order, is the boot system file is 1, the other file system is 2, such as do not check for 0)

/DEV/VDB1               /data                   ext4    defaults        00

System Boot Auto Mount (/etc/fstab): http://www.cnblogs.com/qiyebao/p/4484047.html

Linux commands-Add new hard disk, partition and mount [go]

Related Article

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.