Computer, Internet, iOS, Android, Smart Phones,
Microsoft Windows, MAC, Linux Tutorials, Tips and Guides

Hide and Show Hard Disk Partitions in Linux

0

Hard disk drive partitions are made hidden for security purposes or sometimes we just want to hide that is not more often used. In Linux you can hide selected or all partitions of hard disk. The method of hiding partitions greatly depends on the Linux distribution that you are using. Linux has several distributions (flavors). In Ubuntu you can use commands and tell kernel to hide partitions while for Linux Mint you can just use system settings to hide partitions. Use the following guide to hide partitions or disk drives from Linux.

Windows refer to the disk partitions with letters as C, D, E, F. In Linux, it is sdaX or sdbY, where X and Y are the numbers of the partitions on the sda or sdb drives, respectively. If there are 3 partitions on sda drive, then there will be sda1, sda2 and sda3.

Mount all of your drives and/or partitions by clicking the name in Nautilus. Open a terminal by running gnome-terminal. Mounting all is the easier way to find out the device names. Mount will literally tell you that device X is mounted at directory Y with the name Z. You can also look in /proc/partitions or /dev/disks/ but it will only confuse you.

Run the command mount once. From the output, take note of the names of the drive or partitions through its associated label. It will be like:

/dev/sda1 on /media/
/dev/sda2 on /media/

Create a file and give it any name. In my case I have created linux-partition-hide.rules. In this file we will define rule to tell the Linux kernel to hide the desired partitions of hard disk. We can also hide other devices by using it. Linux Kernel is the Linux Core. Command format is case sensitive and the syntax is following:

KERNEL=="device name", ENV{UDISKS_PRESENTATION_HIDE}="1"

For latest Linux (Ubuntu), use IGNORE, instead of PRESENTATION_HIDE

KERNEL=="device name", ENV{UDISKS_IGNORE}="1"

In my case I am hiding sda1 and sda2. Make sure to change the device name that applies to your case.

KERNEL=="sda1", ENV{UDISKS_PRESENTATION_HIDE}="1"
KERNEL=="sda2", ENV{UDISKS_PRESENTATION_HIDE}="1"

If PRESENTATION_HIDE does not work, use IGNORE, like below:

KERNEL=="sda1", ENV{UDISKS_IGNORE}="1"
KERNEL=="sda2", ENV{UDISKS_IGNORE}="1"

Save the file. Copy the file to this path in your linux:

etc -> udev -> rules.d

You can use a command to copy that file to that location, like below:

sudo cp linux-partition-hide.rules /etc/udev/rules.d/

System will notice it because of udev (the device manage for Linux) that looks for changes to the rules folder through inotify (file system event notifier service). You will need to reboot to see changes in effect. You can also use the udevadm command to trigger the new rules. Reboot linux and you will notice that desired partitions are no longer visible in Nautilus.

If you are using Linux Mint and just want to hide partitions from the desktop, use instructions below:

  • Click on Menu and Open System Settings.
  • Under Preferences, Click on Desktop.
  • On the Desktop screen, Uncheck “Show mounted volumes” and click on Close.
  • All the partition drives will be removed from the desktop In Linux Mint 16.

Similar Tips

About Author

The CEO of tipsNinja at your service. I spend quite enough time with computers and smart devices. I learn everyday and I like to share what I learn. You can subscribe to updates or receive updates in your email. If you have any question, or tipsNinja could not help you in any way, please ask it in Questions/Answers section.

Leave A Reply

css.php