1

Topic: Partition table problems on Vista machines

Hi,

I'm seeing some very odd behavior when trying to use partitioning tools on machines that have at least one Vista partition. I first noticed the problem when using Partition Magic from within DOS. On one machine it gave completely incorrect values for free space of the Vista partition, and on an other machine it says the partition table is "BAD" for the whole physical drive. Under Windows everything works and CHKDSK is happy. Initial internet searches indicate Vista may NOT be starting partitions on a head/cylinder boundary and Partition Magic probably won't like it, so

I decided to try the Linux based SystemRescueCD v0.3.2 (Jan07) which has some features updated to cope with Vista, but when I try the tools such as fdisk, sfdisk, gparted, parted, gpart I get crazy results (on the drive that has the Vista partition), but all these tools work perfectly on a second identical physical drive with data partitions.

Examples of "crazy results".

Loading gparted shows the whole first physical drive as "unallocated space"! But I'm writing this message after booting into Win2k on that drive, and I can boot into Vista too.  parted says something like "The partition extends beyond the physical disk" and refuses to let me enter any commands.

The only program the gives sensible errors (to me at least) is Partition Magic under windows which seems unhappy about the drive geometry (CHS vs LBA)

===========================================================================================================
Disk Geometry Information for Disk 1:    4462 Cylinders,  255 Heads,  63 Sectors/Track
System              PartSect  # Boot BCyl Head Sect  FS    ECyl Head Sect    StartSect     NumSects
===========================================================================================================
                           0  0  80     0    1    1  07    1023  254   63           63   24,563,322
Info: End C,H,S values were large drive placeholders.
  Actual values are:
        0  0  80      0    1    1  07   1528  254   63        63  24563322
                           0  1  00  1023    0    1  07    1023  254   63   24,563,712   47,134,383
Info: Begin C,H,S values were large drive placeholders.
Info: End C,H,S values were large drive placeholders.
  Actual values are:
        0  1  00   1529    5   13  07   4462  254   63  24563712  47134383
Error #105: Partition didn't begin on head boundary.
  ucBeginHead expected to be 0 or 1, not 5.
Error #106: Partition didn't begin on head boundary.
  ucBeginSector expected to be 1, not 13.
Error #109: Partition ends after end of disk.
  ucEndCylinder (4462) must be less than 4462.

I'm at a loss to understand what's causing the problem, but I'm only seeing it on the two machines that I've used Vista on. I think the cluster count is higher than the total number of clusters and this is confusing the partitioning tools.

If anyone can tell me what to type at the Linux command prompt to debug the problem, I'll give it a try, it might help to make gparted and other tools know how to deal with problematic Vista partitions rather than just saying the whole drive is unallocated space.

Thanks.

2

Re: Partition table problems on Vista machines

Hi,

I've looked into this in more detail. A brief summary of the issues:

PHYSICALDRIVE0, 2 Partitions, #1=C:Win2k, #2=V:Vista (dual boot)
PHYSICALDRIVE1, 3 Partitions, #1=S:Swap, #2=E:Media, #3=D:Data

Under windows everything works perfectly including dual boot, but all partitioning software I've tried such as fdisk, sfdisk, gparted, parted, gpart, Partition Magic, will FREAK when trying to use PHYSICALDRIVE0, they all work perfectly on PHYSICALDRIVE1. They do NOT like the Vista partition and I've seen similar problems on an other machine that had a Vista Partition.

I decided to strip out the noise, and look only at the block level layout of these partitions, where they begin and where they end. I decided to create the MAP from within Windows because we know it all works under Windows. Everything looks perfect except the Vista partition! The results (even under Windows don't make sense to me).

Scroll down to see the MAP.

On PHYSICALDRIVE1 (the second disk) all three partitions are laid out perfectly end-to-end (#1 and #2 are transposed but this is fine). Each starting block comes exactly after the previous ending block and if you add up all blocks it's EXACTLY the total number of blocks on the physical disk.

On PHYSICALDRIVE0 (the first disk) the second partition (#1) for Vista does not make sense. The first partition (#0 with Win2k) ends at block 24563385, but Vista (#1) starts at 24563712, a gap of 327 blocks. Perhaps not a big deal, but now add the length of the Vista partition 47134383 and you get 71698095, which means it's GONE BEYOND THE END of the physical disk by 16065 blocks!!

Looking inside the NTFS boot sector, the blocks required are listed as 47120383, so even if I reduced the sector boundaries in the partition table, it would not fit! It's as if Vista has squeezed some extra blocks into the physical layout.

---------- DISK MAP ----------

SCSI Controller : LSI Adapter, Ultra320 SCSI 2000 series, w/1020/1030
Found 2 Logical Elements

SCSI ID 2 : 0 : \\.\PHYSICALDRIVE0 : IBM IC35L036UWDY10-0 SCSI Disk Device
C,H,S 4462 * 255 * 63 = Total 71682030, CheckSum 71682030

Found 2 Partitions
        DiviceID : Disk #0, Partition #0
        StartingBlock : 63
        NumberOfBlocks : 24563322
        EndBlock (calc): 24563385

        DiviceID : Disk #0, Partition #1
        StartingBlock : 24563712
        NumberOfBlocks : 47134383
        EndBlock (calc): 71698095


SCSI ID 6 : 1 : \\.\PHYSICALDRIVE1 : HITACHI HUS151436VL3600 SCSI Disk Device
C,H,S 4462 * 255 * 63 = Total 71682030, CheckSum 71682030

Found 3 Partitions
        DiviceID : Disk #1, Partition #0
        StartingBlock : 63
        NumberOfBlocks : 24579387
        EndBlock (calc): 24579450

        DiviceID : Disk #1, Partition #1
        StartingBlock : 48130740
        NumberOfBlocks : 23551290
        EndBlock (calc): 71682030

        DiviceID : Disk #1, Partition #2
        StartingBlock : 24579450
        NumberOfBlocks : 23551290
        EndBlock (calc): 48130740

3

Re: Partition table problems on Vista machines

thanks for your research! Unfortunately i don't have sufficient time atm to find a fix, but eventually we'll get to it smile

4

Re: Partition table problems on Vista machines

Any news on this problem?  My system has vista on partition 3 and debian on p7.  I get this with cfdisk: 

cfdisk wrote:

FATAL ERROR: Bad primary partition 3: Partition ends after end-of-disk
Press any key to exit cfdisk

and this with fdisk -l: 

fidsk -l wrote:

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x08000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          14      112423+  de  Dell Utility
/dev/sda2              15        1320    10485760    7  HPFS/NTFS
/dev/sda3   *        1320        3785    19803128+   7  HPFS/NTFS
/dev/sda4            3786       19458   125893372+   f  W95 Ext'd (LBA)
/dev/sda5            3786        5090    10482381    7  HPFS/NTFS
/dev/sda6            5091        6395    10482381    c  W95 FAT32 (LBA)
/dev/sda7            6396        6917     4192924   82  Linux swap / Solaris
/dev/sda8            6918        9528    20971520   83  Linux
/dev/sda9           19131       19458     2620416    c  W95 FAT32 (LBA)

anything look out of place here to you experts? 

it's obviously a dell system (laptop) and so originally had 4 partitions.  i used vista to resize it's partition a bit and then resorted to gparted live cd (pretty damnably useful, btw! :-)) utils to shrink it more and create the other partitions.  unfortunately my memories of the exact method that finally succeeded have faded somewhat.  later on, when i tried to delete and re-create a logical partition in vista it ate all following partitions as well as the MBR and i hadn't backed up the MBR yet!  i resorted to the cd again and found i had to fall back to using fdisk rather than gparted to be able to see the partitions properly.  testdisk was indispensible, though i used a later version (6.8?) than on my live cd as it understands vista stuff better. 

do you think billyG can count?...  ;-) 

diskpart.exe doesn't seem to notice any problem so it's obviously not as intelligent as cfdisk or gparted!  Er, maybe you can point me to another forum as this doesn't seem to be a gparted problem as such, but it sure stops it showing partitions. 

TIA.

5

Re: Partition table problems on Vista machines

Weird:
/dev/sda2 end @ 1320
/dev/sda3 start @ 1320 !!!
Perhaps it was bur to some geometry definition problem.

I see that 160041885696/8225280=19457.3 cylinders, so the last cylinder isn't complete. I don't know if this is a problem, but I think that some operating systems could encounter problem. I know that usually Linux looks at the real thing and doesn't care about these definitions (as some msdos versions do). Anyway, I'm not expert on these questions. I've heard that (Linux) fdisk is usually more reliable than cfdisk.

What if you try to resize the /dev/sda2 partition to end to 1319 rather than 1320? What shows the Gparted screen for this disk?

*** It is highly recommended to backup any important files before doing resize/move operations. ***

6

Re: Partition table problems on Vista machines

Thanks for your response.  I've now had a chance to clean things up a bit more but I still get the exact same error message to this new layout as previously: 

fdisk -l wrote:
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          14      112423+  de  Dell Utility
/dev/sda2              15        1289    10240000    7  HPFS/NTFS
/dev/sda3   *        1320        3785    19803128+   7  HPFS/NTFS
/dev/sda4            3786       19458   125893372+   f  W95 Ext'd (LBA)
/dev/sda5            3786        5090    10482381    7  HPFS/NTFS
/dev/sda6            5091        6395    10482381    c  W95 FAT32 (LBA)
/dev/sda7            6396        6917     4192924   82  Linux swap / Solaris
/dev/sda8            6918        9528    20971520   83  Linux
/dev/sda9            9529        9857     2642692+   c  W95 FAT32 (LBA)

Interestingly, when i re-created sda9 fdisk suggested block 9528 as its starting position, so I'm thinking mid-cylinder partition starts can be created with fdisk.  Despite this I made sure there was no overlap in terms of block numbers. 

When I restored data to the new sda9 using clonezilla (another cool tool!) it complained when trying to resize the fs to the new partition size with something like: 

clonezilla wrote:

Now resize the partition for sda9
Error: Can't have a partition outside the disk!
[..repeated another 3 times..]
parted /dev/sda resize 9
Error: Can't have a partition outside the disk!
Information[...]

Maybe the sectors view gives finer-grained information here:

fdisk -lu wrote:
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63      224909      112423+  de  Dell Utility
/dev/sda2          225280    20705279    10240000    7  HPFS/NTFS
/dev/sda3   *    21196800    60803056    19803128+   7  HPFS/NTFS
/dev/sda4        60806025   312592769   125893372+   f  W95 Ext'd (LBA)
/dev/sda5        60806088    81770849    10482381    7  HPFS/NTFS
/dev/sda6        81770913   102735674    10482381    c  W95 FAT32 (LBA)
/dev/sda7       102735738   111121585     4192924   82  Linux swap / Solaris
/dev/sda8       111121668   153064707    20971520   83  Linux
/dev/sda9       153067320   158352704     2642692+   c  W95 FAT32 (LBA)

Aha - it now looks like the extended partition sda4 is too big for the disk!  The error seems to indicate that cfdisk is counting partitions in a zero-based manner for a change?  I'll shrink my extended partition and report back again... 

BTW what do the little '+' signs mean on the Blocks column? 

Another observation is that vista's disk management UI now thinks sda7 and sda8 are primary partitions, despite obviously being in the middle of a logical disk chain.  I certainly won't try to use it to modify anything on this disk. 

Enjoy!  :-)

7

Re: Partition table problems on Vista machines

Ok, so here's my latest layout, modified using fdisk only (ie no hokey hex editing): 

fdisk -l /dev/sda wrote:
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63      224909      112423+  de  Dell Utility
/dev/sda2          225280    20705279    10240000    7  HPFS/NTFS
/dev/sda3   *    21196800    60803056    19803128+   7  HPFS/NTFS
/dev/sda4        60806025   312581807   125887891+   5  Extended
/dev/sda5        60806088    81770849    10482381    7  HPFS/NTFS
/dev/sda6        81770913   102735674    10482381    c  W95 FAT32 (LBA)
/dev/sda7       102735738   111121585     4192924   82  Linux swap / Solaris
/dev/sda8       111121668   153064707    20971520   83  Linux
/dev/sda9       153067320   158352704     2642692+   c  W95 FAT32 (LBA)

and this is what cfdisk thinks of it now: 

cfdisk /dev/sda wrote:
FATAL ERROR: Bad primary partition 3: Partition ends in the final partial cylinder
Press any key to exit cfdisk

Doh!  I just read the error properly - seems i'll have to do some changes once more... 
It claims there's a partial last cylinder - does this make sense? 
IMV cfdisk and g/parted should be robust to such alleged silliness in the table so at least they can be used to fix it up and/or move stuff about in a more friendly manner than resorting to fdisk... 
TIA.

8

Re: Partition table problems on Vista machines

Ok, so i've been a bit slow here, but maybe it can help someone fix something to make it easier in future?  My new table looks like this: 

fdisk -lu /dev/sda wrote:
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63      224909      112423+  de  Dell Utility
/dev/sda2          225280    20705279    10240000    7  HPFS/NTFS
/dev/sda3   *    21196800    60803056    19803128+   7  HPFS/NTFS
/dev/sda4        60806025   312576704   125885340    5  Extended
/dev/sda5        60806088    81770849    10482381    7  HPFS/NTFS
/dev/sda6        81770913   102735674    10482381    c  W95 FAT32 (LBA)
/dev/sda7       102735738   111121585     4192924   82  Linux swap / Solaris
/dev/sda8       111121668   153064707    20971520   83  Linux
/dev/sda9       153067320   158352704     2642692+   c  W95 FAT32 (LBA)

and even cfdisk likes it: 

cfdisk /dev/sda wrote:
Disk Drive: /dev/sda Size: 160041885696 bytes, 160.0 GB Heads: 255   Sectors per Track: 63   Cylinders: 19457
Name    Flags   Part Type    FS Type            Label           HSize (MB)
--------------------------------------------------------------------------------------------------
sda1            Primary      Dell Utility                       115.16    
Unusable                                                        0.19
sda2            Primary      NTFS                               10485.76   
Unusable                                                        251.66
sda3    Boot    Primary      NTFS                               20278.41
                Logical      Free Space                         1.52
sda5            Logical      NTFS                               10734.00
sda6            Logical      W95 FAT32 (LBA)                    10734.00
sda7            Logical      Linux swap / Solaris               4293.59
                Logical      Free Space                         0.01
sda8            Logical      Linux ext3                         21474.87
                Logical      Free Space                         1.31
sda9            Logical      W95 FAT32 (LBA)                    2706.15
                Logical      Free Space                         78962.69

[Bootable]  [ Delete ]  [  Help  ]  [Maximize]  [ Print  ]  [  Quit  ]  [  Type  ]
[ Units  ]  [ Write  ]
Toggle bootable flag of the current partition

while i go and make the changes i now need to make (scavenge some space back and relocate the mediadirect partition to the end, etc), perhaps you could kindly explain your statement:

class413 wrote:

Perhaps it was bur to some geometry definition problem.

?  Why would a disk have an incomplete (therefore unusable?) final cylinder? 

FYI:  vista's disk management still shows a muddle of primary and logical partitions/drives, but diskpart.exe is reckoned to be the tool to use now;
fdisk still suggests adding the new linux (sda8) partition in the same cylinder that the linux swap (sda7) partition ends; and
the indispensible testdisk utility caused this problem, though perhaps because of my misinterpretation of its info. 

Now - where's that live gparted cd gone...  smile

9

Re: Partition table problems on Vista machines

About the geometry problem: I think it is not a problem for Linux, just for old m$ systems. Old disks were really defined by heads/sectors/cylinders. This remains even now, but modern O.S.s don't use it.

*** It is highly recommended to backup any important files before doing resize/move operations. ***

10

Re: Partition table problems on Vista machines

Do you imply it's the presence of Fat32 partitions that could be starting the problems here?  Other than the partition, this new-model laptop runs vista and debian.  Maybe i'm not following you here...  ?

11

Re: Partition table problems on Vista machines

I don't think so. I know that it was an issue at the msdos era, but since then the hard disks are much more complicated than the 100 MB and 200 MB hard disks of that era.

Today's hard disks don't have a constant number of sectors per track, as it was with early ones. Now, external tracks have more sectors than internal tracks, to maximize the disk capacity and to be more efficient in in/out operations. That's why the old definition of cylinders is somehow obsolete now. Disk operations are done mainly by disk's internal firmware.

*** It is highly recommended to backup any important files before doing resize/move operations. ***