I'm running Ubuntu 13.04 and I have several hard drives in my computer and all appear with the same icon in the launcher. Is it possible to modify their icons one by one or at least change their color to better find what I'm looking for?


  • Good Question. It can help in future:)
    – Raja G
    Aug 4, 2013 at 10:58
  • does this not work: askubuntu.com/questions/235805/… Just make several .desktop files and change their icon.
    – Rinzwind
    Aug 4, 2013 at 11:02
  • i tried to follow that solutions but it doesn't work, at least for me
    – Lorenzo
    Aug 4, 2013 at 11:32
  • check this out askubuntu.com/questions/70867/…
    – Stormvirux
    Aug 4, 2013 at 11:50
  • 1
    It seems (I didn't notice/mind until now) recently Nautilus stopped using Windows files autorun.inf / desktop.ini to display a custom drive icon instead of the default one in the current icon theme, while still using it for custom folder emblem - strange :/)
    – Sadi
    Aug 4, 2013 at 14:10

1 Answer 1


You can use udev rules to match with your devices and then assign an icon.

NOTE: In this example I will change the icons for 3 devices, usb pendrive, partition with Opensuse and a partition (Raid) with Linux Mint.

enter image description here

For Ubuntu 12.10 and Newer.

1) I have 3 icons in my Desktop for each device (2 png and 1 svg images), copy the 3 icons to the /usr/share/pixmaps folder and give them perms.

enter image description here

  • cd ~/Desktop
  • sudo cp linuxmint.svg pendrive.png opensuse.png /usr/share/pixmaps/
  • cd /usr/share/pixmaps/
  • sudo chmod 644 linuxmint.svg pendrive.png opensuse.png

2) List the usb pendrive to know the "idVendor" and "idProduct", in a Terminal type:

  • lsusb

enter image description here

Write down the numbers after "ID".

In my example:

Bus 002 Device 003: ID 0930:6545 Toshiba Corp. Kingston DataTraveler 102 Flash Drive / HEMA Flash Drive 2 GB / PNY Attache 4GB Stick

The "idVendor" is 0930 and the "idProduct" is 6545
I'm going to match that info with the "ATTRS{idVendor}" and "ATTRS{idProduct}" keys for my usb Pendrive.

3) Make sure your partitions are mounted, then list your partitions and find the attributes.

  • df -h

In my example:

/dev/sdc3 289G 6.3G 282G 3% /media/hermes/OpenSuse

/dev/mapper/pdc_cjjfccgf3 296G 68G 213G 25% /media/hermes/Linux-Mint-Raid

4) List the attributes of the OpenSuse partition with "udevadm info -a -n device name"

  • udevadm info -a -n /dev/sdc3

You can use this info to match the partition.

enter image description here

In this example I'm going to match with the "KERNEL" and "SUBSYSTEM" keys for the OpenSuse.

KERNEL=="sdc3", SUBSYSTEM=="block"

Write down this info.

5) In case of the Linux-Mint-Raid partition, I'm goin to match the rules with the "SUBSYSTEM", "ATTR{size}" and the "ID_FS_LABEL" ENV variable.

List the attributes and variables of the Linux-Mint-Raid partition with "udevadm info -a -n device name" and "udevadm info -q all -n device name".

  • udevadm info -a -n /dev/mapper/pdc_cjjfccgf3
  • udevadm info -q all -n /dev/mapper/pdc_cjjfccgf3

enter image description here

enter image description here

Creating the udev rule.

6) Go to the /etc/udev/rules.d folder and create a file with your favorite editor.
eg: 99-devices-icons.rules

  • cd /etc/udev/rules.d/
  • sudo nano 99-devices-icons.rules

Write down the info to match each device and then with the ENV{UDISKS_ICON_NAME} you will assign an icon.

In my example:

ATTRS{idVendor}=="0930", ATTRS{idProduct}=="6545", ENV{UDISKS_ICON_NAME}="pendrive" KERNEL=="sdc3", SUBSYSTEM=="block", ENV{UDISKS_ICON_NAME}="opensuse" SUBSYSTEM=="block", ATTR{size}=="629145600", ENV{ID_FS_LABEL}=="Linux-Mint-Raid", ENV{UDISKS_ICON_NAME}="linuxmint"

In nano you can save the changes with:

  • Ctrl +O,Enter then Ctrl +X

7) To refresh the udev rules and see the changes, type in a Terminal window:

  • sudo udevadm trigger

enter image description here

For Ubuntu 12.04.

The same but you should assign the icon with ENV{UDISKS_PRESENTATION_ICON_NAME} instead ENV{UDISKS_ICON_NAME}

ATTRS{idVendor}=="0930", ATTRS{idProduct}=="6545", ENV{UDISKS_PRESENTATION_ICON_NAME}="pendrive"
SUBSYSTEM=="block", ATTR{size}=="629145600", ENV{ID_FS_LABEL}=="Linux-Mint-Raid", ENV{UDISKS_PRESENTATION_ICON_NAME}="linuxmint"

Hope this helps.

  • 1
    Aargh...! I thought the answer was right click --> "Set icon". But I forgot, this isn't windows, it's ubuntu! but +1. Jan 5, 2015 at 15:56
  • Note the assignments in the rules above are "=" (single equals) and the tests for equality are "==".
    – Greg Bell
    Apr 11, 2016 at 2:45
  • Your instructions were really great! I was able to use them to assign custom icons to my Windows partition, external hard drive, flash drive, and Kindle. If only the launcher just used Nautilus’s custom icons, this wouldn’t have been necessary! I’m having one problem though: how do I modify the icon for my phone? No matter what attribute I use, it seems I cannot create a rule specifically for my Samsung phone. Thanks! Dec 30, 2016 at 15:20
  • This method still works in 16.04, though I still use UDISKS_ICON_NAME Mar 18, 2017 at 2:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .