Setup AutoFS

You can use AutoFS to mount HDD dynamically.

Install AutoFS

$ sudo yay -S autofs

Configure AutoFS

$ sudo su
# _ID=$(blkid --output value --match-tag PARTUUID /dev/sda1)
# printf "%s%s\n" "extHDD --fstype=auto PARTUUID="\"${_ID}\"" > /etc/autofs/auto.misc
# exit
  1. the first line, change user to root.
  2. the second line, input /dev/sda1’s partition UUID to variable _ID.
  3. the third line, write out _ID infomation to auto.misc file.
  4. the fourth line, exit to root.

Start and Enable AutoFS

$ sudo systemctl start autofs
$ sudo systemctl enable autofs

Check the configuration

$ sudo ls /misc/extHDD

Last Updated on June 5, 2024 by lama-admin


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *