Increase hard drive in CentOS

Source: Internet
Author: User

Increase hard drive in CentOS
1. view the new Hard Disk
# Fdisk-l

The number of the newly added hard disk is/dev/sdb.
2. Hard Disk partitioning
1) enter the fdisk Mode
#/Sbin/fdisk/dev/sdb
2) Input n to partition

3) Select the partition type

There are two options:
Primary p: a maximum of four primary partitions can be created in linux.
Extension e: there can be only one extension partition in linux. Extension partitions cannot be used directly after they are created, and logical partitions must also be created on the extension partition.
Here I select p.
4) Select the number of partitions

You can select four partitions. Here, I only divide them into one partition.
5) set the cylinder. Select the default value here.

6) if you select e (extended partition), you need to create another logical partition.

Select n
It can be seen that this option is different from the one just now, and logical instead of extent appears.
It can be seen that the logical Partition Number starts from 5.
Select l here to create a logical partition.
7) Input w, write to the partition table, and partition

View the/dev directory after the partition is complete.
# Ls-l/dev

If you create an extended partition, you can see the created logical partition sdb5.

We can see the newly generated partition sdb1.
3. format the partition
Format the new partition as an ext3 file system.
1) if the primary partition is created
# Mkfs-t ext3/dev/sdb1
2) If you create an extended partition,
Because the extended partition cannot be used directly, run
#/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, you can only format the logical partitions on the extended partitions.
#/Sbin/mkfs-t ext3/dev/sdb1
Then start formatting.

Finally, write the file system information.
Now you can use the newly created partition.
4. Attach a hard disk
1) create a mount point
Create a storage directory under the root directory
# Mkdir/storage
2) Mount/dev/sdb5 to/storage
# Mount/dev/sdb5/storage
5. Set automatic mounting upon startup
The newly created partition cannot be automatically mounted upon startup. Manual mounting is required each time the machine is restarted.
Modify the/etc/fstab file to set automatic mounting upon startup.
# Vi/etc/fstab
Add a line at the end of the file
/Dev/sdb5/storage ext3 defaults 1 2
The tutorial is complete!

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.