Make grub2 ignore a certain partition

If you don't want to have a certain partition listed in Grub's menu, you can no longer manually edit grub.cfg file because it gets regenerated automatically everytime there's a kernel update or someone runs update-grub.

Instead, you should get the UUID of the offending partition and add it to /etc/default/grub, using the GRUB_OS_PROBER_SKIP_LIST option. For instance, let's say I want to ignore the second partition of sda. You can get its uuid using:

$ blkid /dev/sda2
/dev/sda2: UUID="6ECE6EF8CE6EB84B" TYPE="ntfs" 

Then, add the necessary option to the /etc/default/grub file:


Beware of the special syntax for the skip list: you need to type the partition's UUID followed by @ and the logical path. After that, run:

sudo update-grub

to update the grub menu configuration and the partition will be ignored with a message similar to:

Skipped Windows 7 (loader) on /dev/sda2 by user request.
Written on 2015-08-19