Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've installed a Linux distribution on a friend's PC. He does not know how to use Linux or even Windows very well, and I'd like for it to be as easy as possible. When I installed GRUB, it detected his recovery partition that HP installed for him, and its the first Windows in the list.

After some googling and looking through the grub manual and config files, I still can't figure out how to hide a partition from GRUB. I looked at 30_osprober, but didn't see any clear way to exclude an OS.

Can anyone point me in the right direction for excluding an OS / patition from the GRUB menu?

Thanks, Sam

share|improve this question
up vote 1 down vote accepted

//EDIT// Changed due to edits(I swear this changed while I was typing)

A dirty solution is to edit the grub.cfg, but this would need to happen every time a kernel upgrade happened.


vim /boot/grub/grub.cfg

The correct way to accomplish this is to edit /etc/grub.d/30_os-prober(as you mentioned) and tell it to ignore certain partitions, a good guide can be found here

Dirty solution #2 could be to run a script that comments out that line from the the grub.cfg for your buddy.

share|improve this answer

I followed the guidelines from this post (on the 6 section)

GRUB 2 will find and create a menuentry for the Windows (Vista) Recovery partition. At least in Vista, the menu name is the same as the normal Vista operating partition, the only difference being the parttion designation. To remove the Recovery partition entry from the menu:

  • Backup the existing /etc/grub.d/30_os-prober file, remove the executable bit from the backup so it isn't run during updates, and open the original for editing (the section starts around line 134):

    sudo cp /etc/grub.d/30_os-prober /etc/grub.d/30_os-prober.original  && sudo chmod -x


    gksu gedit +83 /etc/grub.d/30_os-prober &
  • Determine the exact title and the Windows recovery partition. These can be located in the /boot/grub/grub.cfg file. Add the entry below. In the example, the menuentry appeared as "Windows Vista (loader) (on /dev/sda1)". Make sure you select the correct partition as the title may be the same for the normal and recovery titles. The contents for $LONGNAME and ${DEVICE} should be the exact contents between the quotes in the menuentry for the recovery partition:

    for OS in ${OSPROBED} ; do
    DEVICE="`echo ${OS} | cut -d ':' -f 1`"
    LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
    LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`"
    BOOT="`echo ${OS} | cut -d ':' -f 4`"
    if [ -z "${LONGNAME}" ] ; then
    # Added to remove Windows Recovery
    if [ "$LONGNAME" = "Windows Vista (loader)" ] && [ "${DEVICE}" = "/dev/sda1" ] ; then
    # End Added

Save the file, then run:

sudo update-grub

Instead of Vista I had to think Windows 7 (the method is the same) and everything worked.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .