How to hide (block) devices from the device widget

I have successfully reached my goal. I am effectively using zram in dom0 and in templates.

While hoping @marmarek will consider to include SwapOnZRAM by default in the next releases of Qubes based on >= fedora-33, so far I’d be happy to find a solution for annoyance caused by using zram.

Namely, whenever I start any VM, its virtual block device zram0 is also populated to device widget.

For various reasons ranging from cosmetics to security I’d like to hide zram device to be populated/shown in the device widget.

For example, even gnome-disk-utility devs recognzed this and hid zram from the interface since January 9 2021, > versions 3.38.2 and up

Is there a way to achieve this, zram not to be shown in the device widget interface?

What is maybe important is that dom0’s zram isn’t listed in device widget and I can’t remember if I did it somehow, but after researching bash history, couldn’t find any trace of such an action done by me…

Bump in case someone with an idea/solution missed it. Something related to mounting with nodev? How to do that for zram devices in templates and other qubes?

A udev(7) rule in your AppVM('s template) that matches zram devices, sets ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}="1", and is in a file ordered before 99-qubes-block.rules should work.

Thanks @rustybird for taking time to respond.

If this means that I created 30-zram.rules file at the spot, with the content

# Hide qubes-internal drives from udisks, so file selection dialogs

and boot, then it didn’t help. What I’m doing wrong?

It should just be this:


(ACTION!="remove" and SUBSYSTEM=="block" are probably unnecessary, but they keep the rule narrow)

Thanks @rustybird that worked out. I had weird idea that what I initially wrote woud be taken care by 99-… rule line (elswhere comment there).