Mount Partition Automatically

Hello,
I have multiple distros residing on my computer. Grub is found on my Manjaro partition from where I boot into other distros. When booting another distro my Manjaro partition is not mounted automatically. So therefore not seen when using a file manager.

I do not want to use fstab on each distro to mount my Manjaro partition. I realize this is possible but not very practical. In the past this Manjaro partition was visible to all the other distros via use of a file manager.

So how can I automatically mount the Manjaro partition. I know you will request all sorts of command information, so feel free to issue the CLI command.

Thank you.

If your other distros used to automatically mount partitions/attached media … and now does not … manjaro cannot fix that. And there is no configuration that will affect all of them. Use fstab on Mint? Wont matter to Fedora. Implement the systemd approach on Endeavor? It will have no impact on your Ubuntu install. Etc.
If you want your other systems to automount somehow … then you must set them each that way. And if they used to work like that and dont any longer … then something changed there. Either your settings or the distros.

Thanj you for the response.

Nothing will be mounted automatically, except when plug in a USB Flash Drive. Any internal partition won’t by default. The file manager will just offer a one-click mount.

If you rely on file-manager, then take a look at udisks2ctl. You can add it to the autostart of the desktop environment and it will auto-mount it right away. Something like:

# Pretty rough, will print errors and skip if not possible
find /dev -maxdepth 1 -type b -exec udisksctl mount --block-device "{}" \;

or

find -L /dev/disk/by-label/ -type b -exec udisksctl mount --block-device "{}" \;
find -L /dev/disk/by-uuid/ -type b -exec udisksctl mount --block-device "{}" \;

It will automatically mount every possible device. Just create a desktop file and put it in ~/.config/autostart/. Something like:

File: ~/.config/autostart/user-autmount.desktop

[Desktop Entry]
Name=User-Automount
Comment=Search and automount every possible drive after graphical user login
Exec=bash -c 'find -L /dev/disk/by-uuid/ -type b -exec udisksctl mount --block-device "{}" \;'
Type=Application
Terminal=true
StartupNotify=true
NoDisplay=true

A systemd unit is also possible:

File: ~/.config/systemd/user/user-automount.service

[Unit]
Description=Search and automount every possible drive after graphical user login

[Service]
ExecStart=/usr/bin/bash -c '/usr/bin/find -L /dev/disk/by-uuid/ -type b -exec udisksctl mount --block-device "{}" \;'
Type=simple

[Install]
WantedBy=default.target

Then enable it:

systemctl --user enable user-automount.service 
systemctl --user start user-automount.service 

I know you can do it more advanced with templates etc., but at least that is just one command and one file and no root permissions are needed for configuration and running.

Not tested by me, it is a rough template. Adjust it to your needs.

2 Likes