Ubuntu 开机自动挂载硬盘

Ubuntu 开机自动挂载硬盘

flyfish

版本:Ubuntu18.04

1 选择一个想要挂载的硬盘
执行命令

sudo blkid  

结果类似

/dev/sdb1: LABEL="a" UUID="519364af-0bfd-4755-b2c6-c585c6a35c8f" TYPE="ext4" PARTUUID="7b90355d-01"
/dev/sdb5: LABEL="b" UUID="e016ab5a-245d-425e-8b13-532048a1927c" TYPE="ext4" PARTUUID="7b90355d-05"
/dev/sdb6: LABEL="c" UUID="3BCFF3AA1A8F59B0" TYPE="ntfs" PTTYPE="dos" PARTUUID="7b90355d-06"

2 更改文件fstab( file system table)
执行命令

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).
#
#                
# / was on /dev/sda1 during installation
UUID=2b6bee96-7c0c-4e9f-bbdf-32da9e934368 /               ext4    errors=remount-ro 0       1
/swapfile                                 none            swap    sw              0       0
/swap/swapfile none swap sw 0 0

在最后添加一行,这里自动加载LABEL为b的硬盘

UUID=e016ab5a-245d-425e-8b13-532048a1927c /media/santiago/b               ext4    defaults 0       0

你可能感兴趣的:(Linux)