Computing, Linux, system administration

Mounting file systems under a desktop environment in Linux

Under modern Linux desktop environments, file systems are automatically mounted under /media when you try to access them.

a

For example, let’s say you’re logged in as user jonas, and have a removable disk attached where the file system label is work. In, for example, Ubuntu, work will show up in the left pane of your file explorer, and when you click on it, it’s automatically mounted under /media/jonas/work.

Using /etc/fstab or the mount command to mount a file system, interferes with this setup. Your desktop environment will no longer know where your file system is mounted, it might not show up in the pane of your file explorer, and it might not unmount without providing root access.

Instead, you can use the udisksctl command, which integrates nicely with the desktop environment in Ubuntu. For example,

udisksctl mount --block-device /dev/disk/by-label/work

will automatically mount your device under /media/jonas/work. It will still show up in the pane in your file explorer, and you can unmount it without providing root privileges.

This way, you can automate the mounting of file systems; for example, to mount them at login.

The directory /dev/disk/by-label contains an entry for each unmounted file system, and can be used in the classic mount command as well, instead of the usual /dev/sda1, /dev/sdc3, etc.

See also: Mounting file systems by label in Linux

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s