2

I have a script that creates various LVM volumes and uses them to create images etc. When those are not in use (i.e. not mounted by that script), they show up on the dock on Ubuntu 22.04 which breaks the script when it tries to use or remove them.

How can I prevent those volumes from showing up without also preventing USB sticks and the likes to show up?

Seb
  • 61
  • 1
  • 6
  • Are these volumes being included in /etc/fstab? Otherwise, I cannot see how they appear in the dock. – vanadium Sep 14 '22 at 11:52
  • I don't know but this thread might help - the response there by Rich regarding what shows in the dock on 22.04: https://askubuntu.com/questions/1423744/i-can-access-my-windows-drive-and-almost-all-of-my-files-from-windows-through-my/1423774#1423774 – rawston Sep 14 '22 at 17:50
  • Does any of the answers work for you? – user68186 Sep 24 '22 at 14:36
  • If any of the answers below works for you, feel free to up vote the answer and accept the answer as correct by clicking on the gray check mark next to the answer and turn it green ✅. This will mark your problem as solved and help others. – user68186 Feb 14 '23 at 19:36

2 Answers2

2

I have tried this with an Ubuntu Full Install USB, but it should work on LVMs.

The GUI Way

Open the Gnome-disks app and select the device where the logical volumes are on the Left panel.

enter image description here

Here I have selected 123 GB Drive. Within this drive select the logical volume you don't want to show up in Dock and click on the "Gear" icon.

enter image description here

Click on the Edit Mount Options... and this window will open:

enter image description here

First, turn off the User Session Defaults.

Second, Uncheck the box Show in user interface. This is the key step. If you don't uncheck this box, the logical volume will continue to show up in the Dock.

Third, change the Mount Point if you want.

Fourth, select UUID from the available options for Identify As

Finally click the OK button at the right bottom corner.

Enter your password when prompted.

The Terminal Way

The above method creates an entry in the /etc/fstab file. Unlike other entries in the /etc/fstab, this entry does not automatically mount this volume at system startup.

If you want to skip the GUI and prefer the terminal, the corresponding entry in my /etc/fstab is:

UUID=7329-D5F9 /mnt/7329-D5F9 auto nosuid,nodev,nofail,noauto 0 0

Your UUID (UUID=7329-D5F9) and mountpoint (/mnt/7329-D5F9) will be different.

The option that makes the partition/LV show in the doc is x-gvfs-show. This option will be added to the above line if you do not uncheck the box next to Show in user interface.

Repeat for other logical volumes.

Hope this helps

user68186
  • 33,360
0

Just run in terminal

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

However usb sticks will be hidden also.

Pepe N O
  • 126
  • 5