ubuntu自动加载第二块硬盘

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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值