[HOW TO] Hide partitions on Xubuntu
In this post we'll learn how to hide some partitions on Xubuntu. It should work for other Linux distributions and works for any file manager.
Determine Partition Names
Before proceeding you must determine the names of the partitions you want to hide (eg. sda5, sdb1). Open a terminal window and run:
sudo parted -l
This command will output the partition information for each disk (eg. /dev/sda). Pay attention to the partition size and file system type and you should be able to determine the partition number (which is the first column). Just add the partition number to the device name (ignoring the /dev/
part) and you have the partition name.
Hide Partitions
Now we create the /etc/udev/rules.d/99-hide-disks.rules
file and write a line like this KERNEL=="PARTITION_NAME", ENV{UDISKS_PRESENTATION_HIDE}="1"
, for each partition. Don't forget to change PARTITION_NAME
. Update: 12.10 users must use UDISKS_IGNORE
instead of UDISKS_PRESENTATION_HIDE
.
sudo leafpad /etc/udev/rules.d/99-hide-disks.rules
I added this two lines to mine in Xubuntu 12.04:
KERNEL=="sda1", ENV{UDISKS_PRESENTATION_HIDE}="1"
KERNEL=="sda2", ENV{UDISKS_PRESENTATION_HIDE}="1"
In Xubuntu 12.10, it looks like this:
KERNEL=="sda1", ENV{UDISKS_IGNORE}="1"
KERNEL=="sda2", ENV{UDISKS_IGNORE}="1"
After adding the appropriate line to the file and saving it, run this to make the settings take immediate effect (or reboot):
sudo udevadm trigger
thanks for this^
ReplyDeleteso for an lvm setup, would this still work?
what would i enter as they are /dev/mapper/xxxxxxx and not /dev/sdaX
I'm sorry for not answering your question sooner, as I had to do some research.
DeleteI was unable to logical volumes from the Nautilus sidebar using this method, however I found out that mounting the logical volumes outside /media would effectively hide them. So, just edit your /etc/fstab file and change the mounting point for the volume(s) you would like to hide.
P.S. This alternative method works for "regular" partitions too.
It should now be updated (at least for my Ubuntu 12.10):
ReplyDeleteyou don't have to write this (as was originally written):
KERNEL=="sda1", ENV{UDISKS_PRESENTATION_HIDE}="1"
KERNEL=="sdb2", ENV{UDISKS_PRESENTATION_HIDE}="1"
Instead, you should write this:
KERNEL=="sda1", ENV{UDISKS_IGNORE}="1"
KERNEL=="sdb2", ENV{UDISKS_IGNORE}="1"
The rest is the same :)
(Maybe for Xubuntu the other version is still working) :)
ReplyDeleteNo, for 12.10 "UDISKS_PRESENTATION_HIDE" no longer works; it must be "UDISKS_IGNORE" instead.
DeleteThanks :D