Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Computers sold with pre-installed Windows 7 have a small "System Reserved" boot partition at the beginning of the disk which is not really necessary as Windows can boot alone or alongside Ubuntu without this. So I've decided to remove it from a couple of machines which went OK (except the extra effort of moving/resizing partitions to the left and sometimes having to repair Windows boot manager).

In one of the machines, however, I was surprised to see that the new partition numbers start from 2 in GParted. And the output of fdisk -l is like this:

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb2   *        2048    52426751    26212352    7  HPFS/NTFS/exFAT
/dev/sdb3        52426752   942684159   445128704    7  HPFS/NTFS/exFAT
/dev/sdb4       942684160   976773119    17044480   12  Compaq diagnostics

It took me some time to discover that the reason for this was the fact that somehow a zero-size invisible partition was left after I deleted that partition as seen in the output of sfdisk -l below:

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdb1          0       -       0          0    0  Empty
/dev/sdb2   *      0+   3263-   3264-  26212352    7  HPFS/NTFS/exFAT
/dev/sdb3       3263+  58679-  55416- 445128704    7  HPFS/NTFS/exFAT
/dev/sdb4      58679+  60801-   2122-  17044480   12  Compaq diagnostics

Apart from the unseemly partition numbering, I'm curious to know how I can ged rid of this weird partition?

share|improve this question

1 Answer 1

up vote 6 down vote accepted

You can't, because it's not there. On an MBR disk, there are always precisely four primary partition entries, but some of them can be unused. The sfdisk -l command you used lists all of these entries, even if they're unused. In other words, sfdisk -l is showing a "ghost" entry -- the data structures are present, but they don't define a partition. You could shift the numbers so that you've got partitions 1-3 rather than 2-4, but then using sfdisk -l would show a similar "ghost" partition #4. This is not an error, a bug, or a problem; it's just the way the MBR data structures are defined.

I mentioned you can shift the partition numbers. AFAIK, this is awkward to do with fdisk, sfdisk, or parted, and you also risk rendering Windows unbootable if you try, since Windows can be fussy about its partitions. Thus, I don't recommend you try; just live with the fact that your partitions begin with #2. If, however, this bugs you enough to risk an unbootable Windows installation, you could try my FixParts program. It includes an s option that sorts the partitions; that should shift their numbers down by 1. If you try this and Windows doesn't boot, though, I can't help you, since I'm not a Windows expert.

share|improve this answer
    
Thanks for the info. I think I can make Windows bootable again, I've done it many times after re-arranging partitions of Windows disks (although this doesn't guarantee that I won't encounter an unrecoverable situation this time ;-) but the fact that I'll be merely moving this ghost partition to the end makes this venture a bit less tempting ;-) Do you have any idea about what might have caused this although I've done exactly the same partition deletion/move/re-sizing many times before? –  Sadi Mar 10 '13 at 18:45
    
Nothing caused this - I have one HDD with only one partition created and sfdisk -l shows this one and three empty ones, just as Rod said. –  guntbert Mar 10 '13 at 18:49
1  
What "caused this" is the design of the MBR partition layout. It should not be considered a problem or a bug; it's just that MBR has space for precisely four partitions, so if you have fewer of them, you'll have at least one empty partition definition. In Linux, the numbering of these partitions is tied to their position in the data structure. –  Rod Smith Mar 11 '13 at 22:17

Your Answer

 
discard

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.