Add a new hard disk under CentOS and partition and format it
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.9G17G 33%/
Tmpfs 939 M 0939 M 0%/dev/shm
/Dev/sda1 190 M 47M134M 26%/boot
/Dev/sda4 40G 22G16G 59%/data/mysql
/Dev/sdb1 345G 67M327G 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