Hide Partitions on Linux
Hide Windows Partitions on DualBoot
Create a new file /etc/udev/rules.d/99-hide-partitions.rules and add one line per partition you want to hide like so: KERNEL=="sda1",ENV{UDISKS_IGNORE}="1" KERNEL=="sda2",ENV{UDISKS_IGNORE}="1"
After that you need to run “udevadm trigger” as root, the disks should then immediately disappear from file manager
Create a new file /etc/udev/rules.d/99-hide-partitions.rules and add one line per partition you want to hide like so: KERNEL=="sda1",ENV{UDISKS_IGNORE}="1" KERNEL=="sda2",ENV{UDISKS_IGNORE}="1"
After that you need to run “udevadm trigger” as root, the disks should then immediately disappear from file manager
DETAIL
Now the hiding begins! But before that, make sure you know which partitions you want to hide (like how I identified them above). You can also list all of your partitions using the command
sudo fdisk -l to identify them faster. I'm going to be hiding sda1 and sdb2 in the next steps, but you should substitute your partition names instead.- Create a file named
99-hide-disks.rulesusing your favorite editor. This file is where we put the rule to tell the Linux kernel to hide the device. I won’t explain why the file name sounds funny. That will be the subject for another post here if I won’t feel too lazy explaining it. - Put the text below in the file you just created, but make sure to change the device name that applies to your case. On mine I want to hide sda1 and sdb2.The general format is (this is case sensitive):
KERNEL=="device name", ENV{UDISKS_PRESENTATION_HIDE}="1"In my case, I will write the following in 99-hide-disks.rules:KERNEL=="sda1", ENV{UDISKS_IGNORE}="1" KERNEL=="sdb2", ENV{UDISKS_IGNORE}="1"Don’t forget to save when you’re done. - Now copy the file to
/etc/udev/rules.d/with the command,sudo cp 99-hide-disks.rules /etc/udev/rules.d/Now we’re done. This will have been noticed immediately by the system because udev (the device manage for Linux) looks for changes to the rules folder through inotify (this is a file system event notifier service). However it will not be applied until you reboot. Supposedly you can use the udevadm command to trigger the new rules, but I haven’t really tested it yet. Reboot your Ubuntu and notice how the partitions are no longer visible in Nautilus.
Comentários
Postar um comentário