Fdisk-l // first query unmounted hard disk names such as mkfs such as sdb1. ext3/dev/xvdb start to format DF-H Mount/dev/xvdb/home start to mount VI/etc/fstab settings automatically enable start to add/dev/xvdb/home ext3 defaults 0 by format 0 hard disk name: mount point to be mounted in the format: umount/home/ftp2
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
# Fdisk/dev/SDB
2) Input n to partition
3) Select the partition type
There are two options:
? P: a maximum of four primary partitions can be created in Linux.
? E: there can be only one extended partition in Linux. After the extended partition is created, it cannot be used directly. You must also create a logical partition in the extended partition.
Select P here.
4) Select the number of partitions
Enter 1 for only one partition, and then set the cylinder. The default value is enough.
5) Input W to write data to the partition table and the partition ends.
View the/dev directory after the partition is complete.
# Ls-L/dev
We can see the newly generated partition sdb1.
3. format the partition
Format the new partition as an ext3 file system.
# Mkfs-T ext3/dev/sdb1
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/sdb1 to/storage
# Mount/dev/sdb1/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/sdb1/storage ext3 defaults 1 2
Mount and detach a hard disk from centos