Ubuntu16.04 开机自动挂载分区

系统版本:Ubuntu16.04

Ubuntu系统添加了一块硬盘,开机没有自动挂载,下边讲一下方法:

1)创建一个目录,作为硬盘的挂载目录,mkdir /home/shuke。

2)查看硬盘的UUID,使用sudo blkid,结果类似下边的输出:

/dev/sda1: UUID="62ddf23a-39ab-47fe-9a37-62792a0b9119" TYPE="swap" PARTUUID="e5e88599-01"
/dev/sda5: UUID="d05e4ffc-3457-48b7-83e1-e4ef08fd9818" TYPE="ext4" PARTUUID="e5e88599-05"
/dev/sdb5: UUID="4d77ed21-1f2b-47c3-b051-aa372e70e4cd" TYPE="ext4" PARTUUID="3f397bd0-05"

比如,新加的硬盘是/dev/sdb5,那么拿到它相应的UUID:4d77ed21-1f2b-47c3-b051-aa372e70e4cd,并得知其文件系统类型为ext4,下一步备用。

3)编辑系统加载分区的文件sudo gedit /etc/fstab,内容如下:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda5 during installation
UUID=d05e4ffc-3457-48b7-83e1-e4ef08fd9818 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda1 during installation
UUID=62ddf23a-39ab-47fe-9a37-62792a0b9119 none            swap    sw              0       0
UUID=4d77ed21-1f2b-47c3-b051-aa372e70e4cd /home/shuke               ext4    errors=remount-ro 0       1

添加标红的行,然后重启系统即可自动挂载新硬盘(分区)。

大功告成~~~~~~耶!!!!

猜你喜欢

转载自blog.csdn.net/DKBDKBDKB/article/details/81225059