Hard disk identification for Linux:
After 2.6 kernel, Linux will identify the hardware devices, under the/dev/to establish the appropriate device files. such as:
SDA represents the 1th SCSI hard drive
HDA represents the 1th IDE hard disk (that is, the master port connected to the 1th IDE interface)
The scd0 represents a 1th USB drive.
When a new hard drive is added, a corresponding device file is generated in the/dev directory. Cciss's hard drive is an exception, and its
The device files are in the/dev/cciss/directory. Generally use the "fdisk-l" command to list the hard drives currently connected in the system
Device and partition information. The new hard drive has no partition information, only the hard drive size information is displayed.
1. Shut down the server and add a new hard drive
2. Start server, log in as root user
3. View hard Drive information
#fdisk-L
disk/dev/sda:146.1 GB, 146163105792 bytes
255 heads, Sectors/track, 17769 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 104391 Linux
/dev/sda2 5112 40957717+ Linux
/dev/sda3 5113 5243 1052257+ Linux swap/
Solaris
/DEV/SDA4 5244 17769 100615095 5 Extended
/dev/sda5 5244 17769 100615063+ Linux
disk/dev/sdb:291.3 GB, 291331192320 bytes
255 heads, Sectors/track, 17769 cylinders
Units = Cylinders of 16065 * 8225280 bytes
disk/dev/sdb1:291.3 GB, 291331192320 bytes
4. Create a new hard disk partition
Fdisk can use the M command to look at the internal command of the FDISK command;
A: command specifies the boot partition;
D: command to delete an existing partition;
L: command displays a list of partition ID numbers;
M: View fdisk command help;
N: command to create a new partition;
P: command to display the partition list;
T: Command modifies the partition's type ID number;
W: The command is to save changes to the partition table to make it work.
#fdisk/dev/sdb
Command (M for help): N
Command Action
e extended//input E to create an extended partition
P primary partition (1-4)
Partion Number (1-4): 1
Command (M for help): W
Enter the n return, enter the P return, and then output 1 back to the car, all the way to return, the last input W return to save.
Check this out:
Fdisk-l
You can see the/DEV/SDB1 partition
5. Format the partition:
Mkfs.ext3/dev/sdb1
6. Create/data1 directory:
Mkdir/data1
7. Mount Partition:
Mount/dev/sdb1/data1
8. Configure the Power-on mount automatically
Because mount Mount fails after restarting the server, the partition information needs to be written to the/etc/fstab file for permanent mount:
Vi/etc/fstab
Join:
Label=/data1/data1 ext3 Defaults 1 2
View Cat/etc/fstab
label=//ext3 Defaults 1 1
Label=/data/data ext3 Defaults 1 2
Label=/data1/data1 ext3 Defaults 1 2
Label=/boot/boot ext3 Defaults 1 2
TMPFS/DEV/SHM TMPFS Defaults 0 0
Devpts/dev/pts devpts gid=5,mode=620 0 0
Sysfs/sys Sysfs Defaults 0 0
PROC/PROC proc Defaults 0 0
Label=swap-hda3 Swap Defaults 0 0