1. Review the information on the hard disk
df -h command to find the target hard disk (according to the disk partition (path), partition size, mount point acknowledgment / targets)
sudo blkid command to find the target hard disk UUID , (look format the partition type, such as ext4, ntfs etc.)
Below, i need four disks mounted automatically:
/ dev / sdb 3.6T 437G 3.0T 13% / media / administrator / SEAGATE- 4T / dev / sdc2 400G 267G 134G 67% / media / administrator / F / dev / sdc1 300G 254G 47G 85% / media / administrator / E / dev / sdc3 232G 110G 122G 48% / media / administrator / G
======================================================================================
/dev/sdb: LABEL="SEAGATE-4T" UUID="9da4d57a-7b8e-4b29-b182-cc8355632085" TYPE="ext4"
/dev/sdc1: LABEL="E" UUID="2EF200A9F20076FD" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="8f377501-caad-4084-9297-57d0489c07f4"
/dev/sdc2: LABEL="F" UUID="9EA61E53A61E2C71" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="d4b29517-ee54-44c8-a1bc-29a55afd52f3"
/dev/sdc3: LABEL="G" UUID="3C2E2D9D2E2D50E6" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="e22bb744-86a1-4abc-876d-dbf33f3ef0e7"
2. Configure automatically mount
1), the first backup in case of error sudo cp / etc / fstab /etc/fstab.bak
2), edit the document management sudo vim / etc / fstab
Files added to the end of the information needed to mount, format, such as:
UUID=xxxxxxxxxxxxxx /xxx/xxx/Label type ext4 defaults 0 2
UUID=xxxxxxxxxxxxxx /xxx/xxx/Label type auto,x-systemd.automount 0 0
Format Description:
- Add the path can be customized, and finally a directory (Label) is similar to "letter" in a visible mark
- auto, x-systemd.automount mount option can have multiple separated by commas
- (Before a) 0 to decide whether this file system backup. 0 means ignore, a backup
- (End) to determine the value of 0 need to check the file system to check the order, an optional number is 0, 1, and 2 . Root 1 should receive the highest priority, all other equipment needs to be checked to 2,0 indicates that the device will not be checked fsck
Parameter details: fstab (Simplified Chinese)
For example, I own also mount to the original path:
UUID=9da4d57a-7b8e-4b29-b182-cc8355632085 /media/administrator/SEAGATE-4T ext4 defaults 0 2 UUID=2EF200A9F20076FD /media/administrator/E ntfs auto,x-systemd.automount 0 0 UUID=9EA61E53A61E2C71 /media/administrator/F ntfs auto,x-systemd.automount 0 0 UUID=3C2E2D9D2E2D50E6 /media/administrator/G ntfs auto,x-systemd.automount 0 0
reference
In ubuntu 18.04 set at the boot automatically mount removable hard disk https://ywnz.com/linuxjc/1963.html
ubuntu boot automatically mount the disk and modify the home directory https://www.jianshu.com/p/c58ee79caedb