Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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 used to have a dual boot in one of my hard disk drives - Ubuntu and Windows 7. Then, I added a SSD which is now my main hard disk drive, and I'm using it for Windows 7 completely, keeping Ubuntu in the old HD. I restored the Grub so everything works ok, except for one thing.

Everytime I update the grub, it detects two windows:

Found Windows 7 (loader) on /dev/sda1
Found Windows 7 (loader) on /dev/sdb1

Obviously, I don't want it to detect the Windows on sdb1. Because I no longer use it (I manually deleted the files). What can I do about that without wiping out completely the partition?

share|improve this question
How did you delete all the files? Not from Windows, I assume, since it wouldn't allow you to do that while it's running. Can you just reformat the partition, which will clear the directory completely? GRUB is probably detecting the Windows boot files. – Marty Fried Jun 17 '12 at 19:35
I deleted them from linux. Using ls -la, no hidden or boot files appear, which is pretty weird. – José Tomás Tocino Jun 17 '12 at 19:48
I added an answer because it was too long for a comment. It's not complete, but will work if nobody comes up with anything better. – Marty Fried Jun 17 '12 at 20:46
up vote 3 down vote accepted

I'm not sure what it uses to detect the OS. I'd try a quick reformat of the partitions.

If nothing else works, here is a patch that can be made to /etc/grub.d/30_os-prober that will allow you to specify any partitions you want to skip:

/etc/grub.d/30_os-prober modification

These lines can be added to the file (just past the middle) to skip any partitions that you don't want to show up in the menu. Leaving the string empty will skip nothing.

Add the lines starting with

############## Patch to prevent some partitions being autodetected


############## End of patch:

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`"

  ############## Patch to prevent some partitions being autodetected
  # SKIP_THESE_DEVICES="sda1 sdb1 sdb2"   example for multiple devices
  # SKIP_THESE_DEVICES=""                 example for no devices

  PARTITIONNAME="`echo ${DEVICE} | cut -c 6- 2> /dev/null`"
  if [ "`echo ${SKIP_THESE_DEVICES} | grep -e ${PARTITIONNAME} 2> /dev/null`" ] ; then
  ############## End of patch

  if [ -z "${LONGNAME}" ] ; then

After changing this file, you will, of course, need to run sudo update-grub to regenerate the menu. You should be able to see the results from the terminal's output when it says "Found ..." for each entry; you can run it first before the mods, then compare the output to after the mods. You should not see the removed entries.

share|improve this answer

If Windows 7 is still getting detected, it means that the parition you made still contains some bootloader files of Windows 7. Why not delete the partition itself? That will definitely solve this issue.

I suggest that you keep a backup of any files you want, and delete the partition of your Windows 7 in your old HD. After that update the grub.

I don't think I need to suggest tools to you, but Gparted is the best partition editor from what I know.

share|improve this answer

You should use a Gparted live cd to delete your windows partition on the old HD. But you may have to fix grub after you do this.

share|improve this answer

With grub2, you can skip a device by adding a line similar to the following in your /etc/default/grub file:


GRUB_OS_PROBER_SKIP_LIST is a space-separated list of devices that should be skipped during the os probing stage of update-grub. Each device is of the format <UUID>@<DEVICE>, where DEVICE is the skipped device's path, and UUID is its blkid, which you can obtain by typing:

blkid /dev/sdb1

Once you've updated your /etc/default/grub file, just run update-grub.

sudo update-grub

In the output, you should see if the device was successfully skipped.

share|improve this answer

You can use wipefs to wipe the filesystem metadata so that the NTFS Windows partition is no longer detected. You will loose all the data in the partition.

You simply run

sudo wipefs -a /dev/sdb1

The command ends in the second it is run and it is quicker that deleting the partition or deleting the files.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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