1、查看硬盘分区sudo fdisk -l
Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders, total 234441648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007f002
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 201136127 100567040 83 Linux
/dev/sda2 201138174 234440703 16651265 5 Extended
/dev/sda5 201138176 234440703 16651264 82 Linux swap / Solaris
Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes <=新硬盘
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
2、建立硬盘分区fdisk /dev/sdb
按顺序执行以下指令
m,可以看到帮助信息
n,添加新分区
p,选择添加主分区
l,选择主分区编号为1,这样创建后的主分区为sdb1
w:保存分区表信息
执行fdisk -l
Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders, total 234441648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007f002
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 201136127 100567040 83 Linux
/dev/sda2 201138174 234440703 16651265 5 Extended
/dev/sda5 201138176 234440703 16651264 82 Linux swap / Solaris
Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
81 heads, 63 sectors/track, 765633 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x369cc4ff
Device Boot Start End Blocks Id System
/dev/sdb1 2048 3907029167 1953513560 83 Linux
3、格式化硬盘sudo mkfs -t ext4 /dev/sdb1
4、挂载:就放到/home/work/backup下吧,这个目录以后可以在桌面看到
#mkdir /media/sdb1
#mount /dev/sdb1 /media/sdb1
mkdir /home/work/backup
chmod -R 777 /home/work/backup
mount /dev/sdb1 /home/work/backup
5、自动挂载硬盘
sudo vim /etc/fstab
/dev/sdb1/media/sdb1 ext4 defaults, 0 2
#/dev/sdb1 /home/work/backup ext4 defaults, 1 2
/dev/sdb1 /home/work/backup ext4 auto 0 0
手动挂载成功,好像不同的系统自动挂载方法不一样
参考:http://www.linuxidc.com/Linux/2008-07/14278.htm