Whether mounted (usb) drives are showing up in the Unity launcher or not, has nothing to do with fstab.
Run the following command to reset the blacklist and show all mounted devices again in the launcher:
gsettings set com.canonical.Unity.Devices blacklist "[]"
Explanation
When you unlock mounted volumes from the launcher, you actually add them to a blacklist (com.canonical.Unity.Devices
), that prevents them from showing up in the launcher. They will be mounted nevertheless.
You can see which devices are currently in the blacklist by running the command:
gsettings get com.canonical.Unity.Devices blacklist
Force temporarily blacklisting
To automatically remove blacklisted devices from the blacklist, once they are unmounted, you can run a small script in the background. It watches changes in the list of mounted volumes. If a device gets disconnected, the script removes its (possible) mention in the blacklist.
The device will then appear again in the launcher on the next time it is connected.
How to use
- Copy the script below into an empty file (use e.g.
gedit
).
- Save the file somewhere as
rm_blacklist.py
.
For a clean start, reset the blacklist with the command:
gsettings set com.canonical.Unity.Devices blacklist "[]"
Test- drive the script by opening a terminal window and run the command:
python3 /path/to/rm_blacklist.py
While keeping the terminal window open (running the script):
- Insert a pen drive. Wait a few seconds until it is mounted, then unlock it from the launcher
- Disconnect the pen drive.
- Insert it again after a few seconds; it should now re-appear in the launcher.
If all works as you want, add it to your Startup Applications:
Dash > "Startup Applications" > Add. Add the command:
python3 /path/to/rm_blacklist.py
The script
#!/usr/bin/env python3
import subprocess
import time
def get_info(cmd):
return subprocess.check_output(["/bin/bash", "-c", cmd]).decode("utf-8")
def get_mountedlist():
devices = get_info("lsblk").splitlines()
return [l.split("/")[-1].strip() for l in devices if "/" in l and not l.endswith("/")]
def get_blacklist():
try:
return eval(get_info("gsettings get com.canonical.Unity.Devices blacklist"))
except SyntaxError:
return []
while True:
curr_blacklist = get_blacklist()
mounted_blacklisted = sum([[it for it in curr_blacklist if m in it] for m in get_mountedlist() ], [])
if '-' in curr_blacklist:
mounted_blacklisted = mounted_blacklisted+['-']
if not curr_blacklist == mounted_blacklisted:
cmd = "gsettings set com.canonical.Unity.Devices blacklist "+'"'+str(mounted_blacklisted)+'"'
subprocess.Popen(["/bin/bash", "-c", cmd])
time.sleep(3)