How can I set different icons for drives in dock?

All we need is an easy explanation of the problem, so here it is.

I’m trying to figure out how to change icons for individual drives.

As you can see the last three are indistinguishable until hovered:

How can I set different icons for drives in dock?

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

Use x-gvfs-icon in /etc/fstab

The trick with autorun.inf suggested by pLumo seems not to work anymore, but one can set icons via the x-gvfs-icon option in /etc/fstab.

For this option only icons that are provided through an icon theme can be used.

Set x-gvfs-icon with gnome-disks

If you want to be on the safe side, make a backup copy of your /etc/fstab first:

sudo cp /etc/fstab /etc/fstab.backup

Open gnome-disks (it is under Activities -> Utilities – Disks). Find the partition for which you want to change the icon, select it (it must be highlighted) and click on the gear icon ("Additional partition options").

In the menu, that pops up select "Edit Mount Options…".

In the dialog you must first switch off "User Session Defaults". Then under "Icon Name" you can place a name known to the icon theme. For a first test you could put gnome-cd, which will get you an CD-icon. How to find icon names and how to add custom ones I will explain in the following two sections.

Before clicking "OK", ensure yourself, that the other options are correct, for example "Mount at system startup". When you click "OK", enter your password, which will then save those settings in /etc/fstab. Usually gnome-disks provides you with good default options, but still you have to handle them with care.

The new entry in /etc/fstab that has been created for us could for example look like this:

/dev/disk/by-uuid/<the-uuid> /mnt/<the-uuid> auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-icon=<name-of-the-icon>,noauto 0 0

How can I set different icons for drives in dock?

Find some icon names in the theme

Icons are located under /usr/share/icons/<theme-name>/<size>/<topic>, so for example to look up 48×48 device icons in the Yaru theme one can do:

ls /usr/share/icons/Yaru/48x48/devices/

The name for x-gvfs-icon is simply without the file ending.

How to create a small custom icon theme

This are a few steps to create custom icons that can be used for x-gvfs-icon option.

I assume in this description that you have put an icon called mydrive.png into ~/Downloads. Formats accepted are PNG or SVG, ICO did not work for me. The size should be somewhere between 32 and 128 pixels for PNG.

  1. prepare the folders

    sudo bash
    cd /usr/share/icons/
    mkdir -p custom/any/devices

    I assume that you do not want to maintain different sizes, so I just used any for the size.

  2. create the index.theme file

    nano custom/index.theme

    and put the following content into it:

    [Icon Theme]
    Comment=Icons added by the user

    Note that the "Size" parameter is just a hint for GTK, the actual size of the file can differ.

  3. copy a new icon

    cp ~/Downloads/mydrive.png /usr/share/icons/custom/any/devices
  4. link to the new theme from existing themes

    Here if you are using different theme now, you must replace Yaru with the name of your theme. I edit Humanity here too, because it is a fallback for many themes.

    Edit (nano ... or gedit ...) the files


    and add ...,custom to the Inherits= option.
    That gives for Yaru:


    and for Humanity:


    Exit the super user bash with exit.

Done! Now the name mydrive can be used as "Icon Name" in gnome-disks!

After copying new icons, a restart of Gnome (logoff + logon) might be required!

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply