在Ubuntu下自动挂载硬盘
服务器的硬盘空间越来越小,想办法增加多一个硬盘来解决问题,按以下步骤操作:1,新建一个挂载点,如: /data
2,fdisk -l 查看硬盘的信息
3,更改/etc/fstab文件
实例:
1,mkdir /data
2,运用fdisk -l命令,第二块硬盘是我们要挂载的硬盘,(红色字体)
root@backup:/home/abc# fdisk -l
Disk /dev/sda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x6dab22d0
Device Boot Start End Blocks Id System
/dev/sda1 * 1 9726 78124063+ 83 Linux
/dev/sda2 9727 23955 114294442+ 83 Linux
/dev/sda3 23956 24321 2939895 5 Extended
/dev/sda5 23956 24321 2939863+ 82 Linux swap / Solaris
Disk /dev/sdb: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xf7dbf7db
Device Boot Start End Blocks Id System
/dev/sdb1 1 24321 195358401 83 Linux
3,编辑/etc/fsta文件,实现开机自动挂载.如下增加红色字体
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# /dev/sda1
UUID=c7ffb453-6da1-46fb-83b7-301cde2f7f32 / ext3 defaults,errors=remount-ro 0 1
# /dev/sda5
UUID=f8c79f4c-d077-47a8-b2cb-9952e3ce9276 /home ext3 usrquota,grpquota,acl 1 2
# /dev/sda6
UUID=b9c73b07-0d76-432d-8168-3953172e1303 none swap sw 0 0
/dev/hda /media/cdrom0 udf,iso9660 user,noauto,exec 0 0
/dev/sdb1 /data ext3 usrquota,grpquota,acl 1 2
4,reboot后可以看到在/data分区