How to add a hard disk to a Centos Server
Linux hard disk recognition:
Sda indicates 1st SCSI hard disks
Hda indicates 1st IDE Hard Disks
1st USB optical drives
You can use the "fdisk-l" command to list the hard disks currently connected to the system.
Steps:
1. Disable the server and add a new hard disk.
2. Start the server and log on as the root user.
3. View hard disk Information
Fdisk-l
Appears:
Disk/dev/sda: 146.1 GB, 146163105792 bytes
255 heads, 63 sectors/track, 17769 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Device Boot Start End Blocks Id System
/Dev/sda1*1 13 104391 83 Linux
/Dev/sda2 14 5112 40957717 + 83 Linux
/Dev/sda3 5113 5243 1052257 + 82 Linux swap/
Solaris
/Dev/sda4 5244 17769 100615095 5 Extended
/Dev/sda5 5244 17769 100615063 + 83 Linux
Disk/dev/sdb: 291.3 GB, 291331192320 bytes
255 heads, 63 sectors/track, 17769 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Disk/dev/sdb1: 291.3 GB, 291331192320 bytes
4. Create a New Hard Disk Partition
Fdisk can use the m command to view the internal command of the fdisk command;
A: The command specifies the start partition;
D: Command to delete an existing partition;
L: The command displays the list of partition ID numbers;
M: view the fdisk Command help;
N: Create a New partition;
P: Command to display the partition list;
T: Command to modify the ID number of the partition type;
W: The command is used to modify and save the partition table.
Fdisk/dev/sdb
Command (m for help): n
Command action
E extended // input e to create an extended partition
P primary partition (1-4)
P
Partion number (1-4): 1
Command (m for help): w
Enter n to press enter, then p to press enter, then 1 to press enter, all the way to press enter, and finally enter w to press enter to save.
View: fdisk-l
The/dev/sdb1 partition is displayed.
5. format the partition:
# Mkfs-t ext3-c/dev/sdb1
6. Create/data directory:
Mkdir/data
7. Mount the partition:
Mount/dev/sdb1/data
8. automatic mounting after startup
# Vim/etc/fstab
9. Add the following content in the last line:
/Dev/sdb1/data ext3 defaults 0 0
10. Test
Umount/data/
Mount-a/data
Df-h