Topic: BSOD after partition resize


I've used gparted to resize NTFS partition of Windows 7. It went quite fast and nice, but after that I can not start Windows 7 any more sad
There is blue screen of death and laptop reboots. Windows rescue mode writes that MBR is corrupted and can not be recovered. So I started gparted again and it shows an error for /dev/sda2: "Current NTFS volume size is bigger than the device size!". Could you please help me?

# fdisk -l

Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xee16b435

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         154     1228800    7  HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2   *         154       19275   153596613+   7  HPFS/NTFS
/dev/sda3           37639       38914    10240000    7  HPFS/NTFS
/dev/sda4           19276       37638   147500797+   5  Extended
/dev/sda5           19276       21707    19535008+  83  Linux
/dev/sda6           21708       37147   124021768+  83  Linux
/dev/sda7           37148       37638     3943926   82  Linux swap / Solaris

Partition table entries are not in disk order

# parted /dev/sda unit s print

Model: ATA ST9320325AS (scsi)
Disk /dev/sda: 625142448s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start       End         Size        Type      File system  Flags
1      2048s       2459647s    2457600s    primary   ntfs             
2      2459648s    309652874s  307193227s  primary   ntfs         boot
4      309652875s  604654469s  295001595s  extended                   
5      309652938s  348722954s  39070017s   logical   ext3             
6      348723018s  596766554s  248043537s  logical   ext3             
7      596766618s  604654469s  7887852s    logical   linux-swap       
3      604659712s  625139711s  20480000s   primary   ntfs     

Results of:
# dd if=/dev/sda of=sda1-jna.pbr bs=512 count=1 skip=2048
# dd if=/dev/sda of=sda2-jna.pbr bs=512 count=1 skip=2459648

are here:


Re: BSOD after partition resize

sda1 looks ok as the NTFS PBR says the size is 2,457,599 sectors in size.
sda2 appears to be the the problem as the NTFS PBR says the size is 602,200,056 sectors in size.

Since you were trying to shrink the partition, we will decrease the NTFS volume size to fit within the partition.

The change I have made to the file is from a length of 602,200,056 sectors:
00000020   00 00 00 00  80 00 80 00  F8 D7 E4 23  00 00 00 00
To a new length of 307,193,226 sectors:
00000020   00 00 00 00  80 00 80 00  8A 65 4F 12  00 00 00 00

Note:  The NTFS volume size is always 1 sector less than the total number of sectors in the partition table entry because the NTFS backup sector is not considered part of the NTFS volume.

To apply this change:

1) Download the new NTFS PBR: sda2-jna_new.pbr

2) Load the new NTFS PBR on your hard disk.
NOTE:  Be extra careful when entering the commands.  Data loss could result otherwise.

dd if=sda2-jna_new.pbr of=/dev/sda bs=512 count=1 seek=2459648

3) Reboot the computer

4) Check that the file system is recognized in GParted

5) If all seems fine then I would advise booting into Windows and running "chkdsk /f /r" multiple times, until there are no more faults.


Re: BSOD after partition resize

Thank you very, very much, you saved me! smile

But I wonder about one thing. I've seen many guys on this forum who have similar problems. Are there any plans to fix it in future versions of gparted?


Re: BSOD after partition resize

jna wrote:

Are there any plans to fix it in future versions of gparted?

This problem is most often discovered when using GParted, but the actual source of the problem lies in the libparted library used by GParted.  The libparted library is part of another project called Parted.  (Lib)Parted versions 1.8.8.+ (not 1.8.8) up to and including 2.2 are known to exhibit this problem to varying degrees.  The problem is much less likely to occur with the more recent versions of parted.

As a result any tool that uses libparted may experience this problem of "failure to inform kernel of partition changes".  This includes GNU/Linux OS installers, QTParted, etc.

Parted 2.3 contains some patches that should further lessen the problem.  Unfortunately it is very difficult to reliably reproduce the "failure to inform kernel of partition changes problem".  As a result we do not know for sure if parted 2.3 still exhibits the problem.

With today's release of GParted 0.6.0 we plan to bundle Red Hat's patched version of parted (parted-2.2-5.fc14) in the next GParted Live release.

After a stable GParted Live 0.6.0-# is created, we plan to further investigate parted-2.3.

We continue to track this issue under the following forum post:
WARNING! Problem Resizing File Systems with GParted