Linux添加硬盘,格式化硬盘的最简单步骤如下,格式化,mount,添加启动自动mount。范例如下:
运行fdisk -l,部分显示如下:
Disk /dev/hdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 1 1305 10482381 83 Linux
对分区进行格式化,mkfs.ext3 /dev/hdb1
挂载硬盘,
root@g11-64-1 ~]# mkdir /mnt/hdb1
[root@g11-64-1 ~]# mount /dev/hdb1 /mnt/hdb1
[root@g11-64-1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda3 19G 8.2G 9.7G 46% /
/dev/hda1 99M 16M 79M 17% /boot
tmpfs 250M 0 250M 0% /dev/shm
/dev/hdb1 9.9G 151M 9.2G 2% /mnt/hdb1
修改文件/etc/fstab, 使得开机自动加载该硬盘分区。加入一行如:
/dev/hdb1 /mnt/hdb1 ext3 defaults 0 0