Add a new hard disk under CentOS and partition and format it

Source: Internet
Author: User
1. first use fdisk-l to check the disk status. The red lines above indicate that I have added a new hard disk/dev/sdb with a size of 350 GB, unpartitioned formatting status. 2. use Fdisk/dev/sdb for partitioning. Input N to create a partition p to create a original partition 1 to indicate that the partition number is

1. first use fdisk-l to check the disk status in the current state.

As shown in the red lines above, I added a new hard disk/dev/sdb, with a size of 350 GB and unpartitioned formatting status.

2. use Fdisk/dev/sdb for partitioning.

Input N to create a partition.

P indicates creating an original partition.

1 indicates that the partition number is 1.

1 indicates the use of the default start cylindrical number. if you want to divide multiple zones, first calculate the size of the column and then enter a number.

Enter: press enter to use the default ending cylinder number. that is, the partition uses the entire hard disk space.

W // Save the partition

3,View the status of the current partition again:

We can see that a new/dev/sdb1 partition has been created. In the next step, format it and then use

4,UseMkfs. ext4Format new partition

5. Mount and use.

[Root @ lan27 ~] # Mkdir-p/data2 //Create a mount point.

[Root @ lan27 ~] # Mount/dev/sdb1/data2 //Mount.

[Root @ lan27 ~] # Df-h

File system capacity used available % mount point

Filesystem Size Used Avail Use % Mounted on

/Dev/sda3 26G 7.9G 17G 33%/

Tmpfs 939 M 0 939 M 0%/dev/shm

/Dev/sda1 190 M 47 M 134 M 26%/boot

/Dev/sda4 40G 22G 16G 59%/data/mysql

/Dev/sdb1 345G 67 M 327G 1%/data2

6,Automatic mounting upon startup

Set automatic mounting for new hard disk boot
Add the mount information of the new hard disk in vi/etc/fstab. add the following line:
/Dev/sdb1/data2 ext4 defaults 1 2 (if another partition is 1 3, and so on)

In this way, after each boot, the system will automatically mount/dev/sdb1 to/data2

 
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.