3

I am new to Ubuntu. I am running dual boot Win7-Ult/Ubuntu 16.04 on an HP Envy j100sv. The Ubuntu partition is intended for malware analysis and I would like to know if there is a way to disable access to the Win7 part of the disk when using Ubuntu, isolating the partition so as it doesn't "know" that there is another drive on the system. The dual boot is being run on a single 1TB HDD.

2
  • perhaps removing the entry for that partition from the /etc/fstab will do the trick. Dec 7, 2016 at 15:56
  • @George on my Ubuntu 16.04 system Win7 and other partitions unrelated to Ubuntu were not put into /etc/fstab automatically. That could be do the upgrade method though??? Dec 8, 2016 at 0:04

3 Answers 3

1

Use disks to hide the partition in Ubuntu

You want to remove the Windows 7 partition from the left left pane in Nautilus, where it can be mounted even when it's not in /etc/fstab. You want to hide the partition so they don't appear in Nautilus or elsewhere through Ubuntu.

Start Dash the first option on the Launcher

Type Disks and you will see the application Disks appear. Click on it.

A screen similar to this appears:

Open Disks

Left click on a Disk. Then left click on the Partition you want to hide.

Right click on the gear (follows the Left Arrow and -) and select Edit Mount Options and this screen appears:

enter image description here

Uncheck the option Show in User Interface.

Click OK and enter password to apply changes. After the next reboot Nautilus won't show the partition. Note that this doesn't erase the partition or delete any data on it.

1

Grub entries only will not show Windows bootable partitions in grub menu. If you do not want to see the NTFS partitions in Nautilus or be able to use them from Linux you actually have to mount them with fstab.

Hide mount template examples with noauto, you have to make the mount points yourself first and use your UUID in place of example's

sudo blkid -o list
sudo mkdir /mnt/win7
UUID=80A02B83A02B7F32 /mnt/win7 ntfs defaults,noauto,umask=777 0 0

The noauto prevents default mounting and 777 is no permissions at all.

1

There are two ways of doing this:

1) by removing (or commenting) following similar strings from file /boot/grub/grub.cfg:

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows 7 (loader) (su /dev/sda4)' --class windows --class os $menuentry_id_option 'osprober-chain-CEDABB32DABB1625' {
    insmod part_msdos
    insmod ntfs
    set root='hd0,msdos4'
    if [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4  CEDABB32DABB1625
    else
        search --no-floppy --fs-uuid --set=root CEDABB32DABB1625
    fi
    parttool ${root} hidden-
    chainloader +1
}
### END /etc/grub.d/30_os-prober ###

Command to modify the file:

sudo nano /boot/grub/grub.cfg

(You can use CTRL+K to cut strings in nano editor)

NB: by using this method, on next update-grub (for example on next kernel upgrade), Windows will appear again in bootable OS list screen (GRUB) on startup.

2) by moving the os-prober file from /etc/grub.d/ in a subfolder (I would call it /etc/grub.d/bak/) so update-grub will not read that file.

Then you have to call an update-grub to update file /boot/grub/grub.cfg.

Commands to execute are:

sudo mkdir /etc/grub.d/bak

sudo mv /etc/grub.d/30_os-prober /etc/grub.d/bak

sudo update-grub

NB: This method will hide every non-linux system on your HDD.

UNDOING PROCESS:

1) for the first method you just need to make a update-grub.

2) for the second one you have to move back the file you moved away from /etc/grub.d/ directory in its original path.

Commands to execute are:

sudo mv /etc/grub.d/bak/30_os-prober /etc/grub.d/

sudo update-grub

==========

If you don't want to see Windows partition while using Ubuntu you just need to remove the string associated with that partition:

Use this command to show wich number has your Windows partition:

sudo blkid -o list | grep ntfs

Then use the /dev/sdXY like string in the following command: (X = letter, Y = number)

enter image description here

sudo echo 'KERNEL=="sdXY", ENV{UDISKS_IGNORE}="1"' > /etc/udev/rules.d/hide-windows.rules

NB: Use your "XY"; the command will looks like the following:

sudo echo 'KERNEL=="sda4", ENV{UDISKS_IGNORE}="1"' > /etc/udev/rules.d/hide-windows.rules

UNDOING PROCESS:

Just remove the created file:

sudo rm /etc/udev/rules.d/hide-windows.rules

1
  • Never edit grub.cfg. you can edit grub's configuration file to have it not search for other files. sudo nano /etc/default/grub and add this line: GRUB_DISABLE_OS_PROBER=true then run sudo update-grub But that only turns off os-prober from finding it for booting. Do you also want to hide it in Nautilus? The you edit fstab to either hide it or prevent mounting.
    – oldfred
    Dec 7, 2016 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.