How do I hide the icon for a mounted volume from the dock on Ubuntu 19.10 and later?

Solution 1:

Open Terminal and run the following command:

gsettings set org.gnome.shell.extensions.dash-to-dock show-mounts false

Solution 2:

In /etc/fstab locate the line that mounts your drive and remove x-gvfs-show

This can also be done in the Disks GUI, select the HDD, choose the options gear and select "Edit Mount Options", specify the options you want and uncheck "Show in user interface"

enter image description here

This will allow other removable media, like USB sticks and external HDD to show up, but your "permanent" extra drives to be hidden as "normal"