I would like to auto-mount some partitions the way USB drives and external HDDs are currently mounted on my system.

I understand that to auto-mount internal HDDs at startup, I need to place it in the /etc/fstab and map its mount point, etc. But I like how my USB drives and external HDDs are automatically mounted to /run/media/myuser/drive-label when I plug them in.

To do this to my internal HDDs, I'd have to use udiskctl mount --block-device /dev/sda4 and it then gets mounted to /run/media/myuser/sda4-label. Is there a way of doing it automatically on boot?

I'm currently using Antergos (Arch Linux)

1 Answer 1


Take a look at the AutoFS service which can facilitate more elaborate automounting scenarios than can be accomplished via the /etc/fstab file.

You can do a variety of things such as automounting devices via a script, when a directory path is accessed.

/media/ssh      /etc/autofs/auto.ssh    --timeout=60

In this scenario if someone were to access /media/ssh the script /etc/autofs/auto.ssh would execute and "mount" whatever directory they attempted to access under /media/ssh.

# /etc/autofs/auto.ssh
servername     -fstype=fuse,rw,allow_other,IdentityFile=/home/username/.ssh/id_dsa :sshfs\#username@host\:/

After 60 secs. of inactivity autofs will unmount the directory.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .