Back in 13.04 I switched from using Unity to using a Gnome session with i3. My setup is a based on this one.
$ cat /usr/share/xsessions/gnome-i3.desktop
[Desktop Entry]
Name=GNOME with i3
Comment=A GNOME fallback mode session using i3 as the window manager.
Exec=gnome-session --session=i3
TryExec=gnome-session
Icon=
Type=Application
$ cat /usr/share/gnome-session/sessions/i3.session
[GNOME Session]
Name=gnome-i3
RequiredComponents=gnome-settings-daemon;i3;
Back in 13.04, and also in 13.10, automounting worked just like in Unity. If I plugged in a removable drive (eg: a USB thumb drive) it'd mount at /media/$USER/$VOLUME_LABEL
.
Under 14.04 this still works if I use Unity, but it no longer works in my preferred Gnome+i3 session.
If I start up nautilus (in a Gnome+i3 session) after plugging in a drive I can see the not-mounted drive in the left pane, but it has no eject button. It also does not show up in the output of df
. If I then click on the drive, an eject button appears, and it will also appear in the output of df
. So it seems that nautilus mounts volumes "on demand".
I've also found that I can run gvfs-mount -oi
to see gvfs events as they happen, and when a drive is attached it generates a pair of events like this:
Drive connected: 'Lexar USB Flash Drive'
Drive(0): Lexar USB Flash Drive
Type: GProxyDrive (GProxyVolumeMonitorUDisks2)
ids:
unix-device: '/dev/sdg'
...
Volume added: 'ALLMYDATAZ'
Volume(0): ALLMYDATAZ
Type: GProxyVolume (GProxyVolumeMonitorUDisks2)
ids:
class: 'device'
unix-device: '/dev/sdg1'
uuid: 'BE64-1766'
label: 'ALLMYDATAZ'
themed icons: ...
symbolic themed icons: ...
can_mount=1
can_eject=1
should_automount=1
sort_key=gvfs.time_detected_usec.1404417627659873
(Note the should_automount=1
bit, yet it still does not automount.)
I can then manually mount the drive with gvfs-mount -d /dev/sdg1
.
So... is there some pre-existing tool that ties these together, mounting the unix-device
of all "Volume added" events that have should_automount=1
? That is, mounting removable volumes as they are added to the system?
Note that I am not looking for a way to have things mount at login or at system startup. I want them to mount when plugged in.