HostOnNet Blog

Hide Disk showing up in Ubuntu Unity Launcher

Looking for Linux Server Admin or WordPress Expert? We can help.

On dual boot systems, you don’t want your windows drive shows up in Unity Launch bar. You can right click and select “Unlock from Launcher”, this work for most case.

To hide a disk from Unity Launcher/Nautilus, you need to find UUID of the disk, this can be found by using blkid command.

root@hon-vpn:~# blkid
/dev/vda5: UUID="9178d98d-45dc-4d8b-a338-ec8b4c9eb06f" TYPE="swap" PARTUUID="8b4b706e-05"
/dev/vdb2: UUID="89cd59c9-432f-42b4-b6f6-e9f779a6a2c6" TYPE="crypto_LUKS" PARTLABEL="primary" PARTUUID="552d752e-df3f-414a-bda9-c336f85f2dab"
/dev/vda1: UUID="f2f3141b-3e26-44bd-8187-f0eaa24b4c0d" TYPE="ext4" PARTUUID="8b4b706e-01"
/dev/sr0: UUID="2015-09-06-11-12-07-00" LABEL="Debian 8.2.0 amd64 1" TYPE="iso9660" PTUUID="7714c637" PTTYPE="dos"
/dev/loop0: UUID="7eb55935-684c-4c48-9c44-34fcef8e1d80" TYPE="crypto_LUKS"
/dev/mapper/volume1: UUID="ed0122c2-8201-4a70-b231-f52375ba7e47" TYPE="ext4"
/dev/vdb1: PARTLABEL="ESP" PARTUUID="75f3df26-d255-4718-b920-46be04c83516"
root@hon-vpn:~# 

Lets say we need to hide drive

/dev/mapper/volume1: UUID="ed0122c2-8201-4a70-b231-f52375ba7e47" TYPE="ext4"

from showing up in Unity launcher, create file

sudo vi /etc/udev/rules.d/99-hide-disks.rules

Add following

SUBSYSTEM=="block", ENV{ID_FS_UUID}=="ed0122c2-8201-4a70-b231-f52375ba7e47", ENV{UDISKS_IGNORE}="1"

The content of the file will be

root@hon-vpn:~# cat /etc/udev/rules.d/99-hide-disks.rules
SUBSYSTEM=="block", ENV{ID_FS_UUID}=="ed0122c2-8201-4a70-b231-f52375ba7e47", ENV{UDISKS_IGNORE}="1"
root@hon-vpn:~# 

Now restart udev.

sudo udevadm control --reload
sudo udevadm trigger

Hiding a Device with out UUID

I wanted to hide USB 3G Dongle from showing up in Ubuntu Unity launcher. This device (MobileWiFi) don’t have a UUID

root@hon-pc-01:~# blkid
/dev/sda1: UUID="6da979ef-61e8-42f8-9e7c-06f9d4d77774" TYPE="ext4" 
/dev/sda2: UUID="3c498e9b-2b60-43dc-aec0-78efd5185506" TYPE="ext4" 
/dev/sda5: UUID="722d15fe-5382-400b-9e7e-8338982f5561" TYPE="ext4" 
/dev/sda6: UUID="239c7429-0670-4db1-808c-b14ce0e45830" TYPE="swap" 
/dev/sdc2: LABEL="part_os" UUID="f7e2b77d-8286-4d76-8170-0ce7c2d75a89" TYPE="ext4" 
/dev/sdc3: LABEL="part_data" UUID="8b269653-7fae-4260-ae29-9750ce5f9384" TYPE="ext4" 
/dev/sdc4: UUID="ed0122c2-8201-4a70-b231-f52375ba7e47" TYPE="crypto_LUKS" 
/dev/sr1: LABEL="MobileWiFi" TYPE="iso9660" 
root@hon-pc-01:~# 

To hide this device, i added

SUBSYSTEM=="block", ENV{ID_FS_LABEL}=="MobileWiFi", ENV{UDISKS_IGNORE}="1"

in file /etc/udev/rules.d/99-hide-disks.rules

Then restarted udev as before.

Posted in Ubuntu

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.