Add a new hard drive under CentOS

Source: Internet
Author: User

1. View New Hard Drive
#fdisk –l

The newly added hard drive is numbered/dev/sdb
2. Hard disk partition
1) Enter Fdisk mode

#/sbin/fdisk/dev/sdb

2) enter N to partition

3) Select the partition type

Here are two options:
? P: Primary partition can have a maximum of 4 main partitions on Linux
? E: There can be only 1 extended partitions on the extended partition Linux, the extended partition cannot be used directly after creation, and the logical partition on the extended partition will be created.
Here I choose the P.
4) Select the number of partitions

can choose 4 partitions, here I only divided into 1 partitions
5) Set the cylinder, select the default value here to

6) If you select E (extended partition), you need to create a logical partition

Select n
You can see that this is the option that appears and just a little different, appearing logical instead of extent.
You can see that the partition number of logical starts at 5.
Select L here to create the logical partition
7) Enter W, write to partition table, partition

After the partition is finished, view the/dev directory
#ls –l/dev

If you are creating an extended partition, you can see the logical partition you created SDB5

You can see the new partition that you just generated SDB1
3. Format the partition
Format the new partition as a ext3 file system
1) If you are creating a primary partition
#mkfs-T EXT3/DEV/SDB1
2) If you are creating an extended partition,
Because the extended partition cannot be used directly, execute
#/sbin/mkfs-t EXT3/DEV/SDB1
command, the system will report the following error
Invalid argument passed to Ext2 library while setting up Superblock
In this case, only logical partitions on the extended partition can be formatted
#/sbin/mkfs-t EXT3/DEV/SDB1
And then you start formatting

Finally, the file system information is written.
You can now use the newly created partition.
4. Mount the hard drive
1) Create mount point
Create the storage directory under the root directory
#mkdir/storage
2) mount the/DEV/SDB1 to the/storage
#mount/dev/sdb1/storage
5, set the boot automatically mount
The newly created partition cannot be mounted automatically and will be mounted manually each time the machine is restarted.
Set boot auto mount requires modification of/etc/fstab file
#vi/etc/fstab
Add a line at the end of the file
/dev/sdb5/storage ext3 Defaults 1 2

Add a new hard drive under CentOS

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.