1

Topic: [SOLVED] Move /dev/sda5 (NTFS) to the right and shrink it ERROR

Hi Guys, I was just trying to adjust the size of one of mi partitions and something has apparently gone wrong. If you can help you are welcome! I'm not an expert and besides all warnings and advices I haven't done a backup of my information (I know what you would think of me) but I'm in real trouble. yikes

Thank you very much in advance!

THE LOG...

GParted 0.4.8

Libparted 1.9.0
Move /dev/sda5 to the right and shrink it from 801.36 GiB to 600.00 GiB  07:52:27    ( ERROR )
        
calibrate /dev/sda5  00:00:02    ( SUCCESS )
        
path: /dev/sda5
start: 272960478
end: 1953525167
size: 1680564690 (801.36 GiB)
calculate new size and position of /dev/sda5  00:00:00    ( SUCCESS )
        
requested start: 695229003
requested end: 1953520064
requested size: 1258291062 (600.00 GiB)
new start: 695228940
new end: 1953520064
new size: 1258291125 (600.00 GiB)
check file system on /dev/sda5 for errors and (if possible) fix them  00:00:06    ( SUCCESS )
        
ntfsresize -P -i -f -v /dev/sda5
        
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sda5
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 860449120768 bytes (860450 MB)
Current device size: 860449121280 bytes (860450 MB)
Checking for bad sectors ...
Checking filesystem consistency ...
Accounting clusters ...
Space in use : 470842 MB (54.7%)
Collecting resizing constraints ...
Estimating smallest shrunken size supported ...
File feature Last used at By inode
$MFT : 327817 MB 0
Multi-Record : 555217 MB 115146
$MFTMirr : 1 MB 1
Compressed : 554271 MB 78838
Ordinary : 556102 MB 115123
You might resize at 470841589760 bytes or 470842 MB (freeing 389608 MB).
Please make a test run using both the -n and -s options before real resizing!
shrink file system  00:00:10    ( SUCCESS )
        
run simulation  00:00:04    ( SUCCESS )
        
ntfsresize -P --force /dev/sda5 -s 644245055999 --no-action
        
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sda5
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 860449120768 bytes (860450 MB)
Current device size: 860449121280 bytes (860450 MB)
New volume size : 644245049856 bytes (644246 MB)
Checking filesystem consistency ...
Accounting clusters ...
Space in use : 470842 MB (54.7%)
Collecting resizing constraints ...
Needed relocations : 0 (0 MB)
Schedule chkdsk for NTFS consistency check at Windows boot time ...
Resetting $LogFile ... (this might take a while)
Updating $BadClust file ...
Updating $Bitmap file ...
Updating Boot record ...
The read-only test run ended successfully.
real resize  00:00:06    ( SUCCESS )
        
ntfsresize -P --force /dev/sda5 -s 644245055999
        
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sda5
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 860449120768 bytes (860450 MB)
Current device size: 860449121280 bytes (860450 MB)
New volume size : 644245049856 bytes (644246 MB)
Checking filesystem consistency ...
Accounting clusters ...
Space in use : 470842 MB (54.7%)
Collecting resizing constraints ...
Needed relocations : 0 (0 MB)
Schedule chkdsk for NTFS consistency check at Windows boot time ...
Resetting $LogFile ... (this might take a while)
Updating $BadClust file ...
Updating $Bitmap file ...
Updating Boot record ...
Syncing device ...
Successfully resized NTFS on device '/dev/sda5'.
You can go on to shrink the device for example with Linux fdisk.
IMPORTANT: When recreating the partition, make sure that you
1) create it at the same disk sector (use sector as the unit!)
2) create it with the same partition type (usually 7, HPFS/NTFS)
3) do not make it smaller than the new NTFS filesystem size
4) set the bootable flag for the partition if it existed before
Otherwise you won't be able to access NTFS or can't boot from the disk!
If you make a mistake and don't have a partition table backup then you
can recover the partition table by TestDisk or Parted's rescue mode.
shrink partition from 801.36 GiB to 600.00 GiB  00:00:01    ( SUCCESS )
        
old start: 272960478
old end: 1953525167
old size: 1680564690 (801.36 GiB)
new start: 272960478
new end: 1531251602
new size: 1258291125 (600.00 GiB)
check file system on /dev/sda5 for errors and (if possible) fix them  00:00:04    ( SUCCESS )
        
ntfsresize -P -i -f -v /dev/sda5
        
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sda5
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 644245049856 bytes (644246 MB)
Current device size: 860449121280 bytes (860450 MB)
Checking for bad sectors ...
Checking filesystem consistency ...
Accounting clusters ...
Space in use : 470835 MB (73.1%)
Collecting resizing constraints ...
Estimating smallest shrunken size supported ...
File feature Last used at By inode
$MFT : 327817 MB 0
Multi-Record : 555217 MB 115146
$MFTMirr : 1 MB 1
Compressed : 554271 MB 78838
Ordinary : 556102 MB 115123
You might resize at 470834991104 bytes or 470835 MB (freeing 173411 MB).
Please make a test run using both the -n and -s options before real resizing!
grow file system to fill the partition  00:00:09    ( SUCCESS )
        
run simulation  00:00:05    ( SUCCESS )
        
ntfsresize -P --force /dev/sda5 --no-action
        
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sda5
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 644245049856 bytes (644246 MB)
Current device size: 860449121280 bytes (860450 MB)
New volume size : 860449116672 bytes (860450 MB)
Checking filesystem consistency ...
Accounting clusters ...
Space in use : 470835 MB (73.1%)
Collecting resizing constraints ...
Schedule chkdsk for NTFS consistency check at Windows boot time ...
Resetting $LogFile ... (this might take a while)
Updating $BadClust file ...
Updating $Bitmap file ...
Updating Boot record ...
The read-only test run ended successfully.
real resize  00:00:04    ( SUCCESS )
        
ntfsresize -P --force /dev/sda5
        
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sda5
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 644245049856 bytes (644246 MB)
Current device size: 860449121280 bytes (860450 MB)
New volume size : 860449116672 bytes (860450 MB)
Checking filesystem consistency ...
Accounting clusters ...
Space in use : 470835 MB (73.1%)
Collecting resizing constraints ...
WARNING: Every sanity check passed and only the dangerous operations left.
Make sure that important data has been backed up! Power outage or computer
crash may result major data loss!
Are you sure you want to proceed (y/[n])? Schedule chkdsk for NTFS consistency check at Windows boot time ...
Resetting $LogFile ... (this might take a while)
Updating $BadClust file ...
Updating $Bitmap file ...
Updating Boot record ...
Syncing device ...
Successfully resized NTFS on device '/dev/sda5'.
calculate new size and position of /dev/sda5  00:00:00    ( SUCCESS )
        
requested start: 695228940
requested end: 1953520064
requested size: 1258291125 (600.00 GiB)
new start: 695228940
new end: 1953520064
new size: 1258291125 (600.00 GiB)
check file system on /dev/sda5 for errors and (if possible) fix them  00:00:05    ( SUCCESS )
        
ntfsresize -P -i -f -v /dev/sda5
        
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sda5
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 860449116672 bytes (860450 MB)
Current device size: 860449121280 bytes (860450 MB)
Checking for bad sectors ...
Checking filesystem consistency ...
Accounting clusters ...
Space in use : 470842 MB (54.7%)
Collecting resizing constraints ...
Estimating smallest shrunken size supported ...
File feature Last used at By inode
$MFT : 327817 MB 0
Multi-Record : 555217 MB 115146
$MFTMirr : 1 MB 1
Compressed : 554271 MB 78838
Ordinary : 556102 MB 115123
You might resize at 470841589760 bytes or 470842 MB (freeing 389608 MB).
Please make a test run using both the -n and -s options before real resizing!
move file system to the right  07:51:48    ( SUCCESS )
        
perform read-only test  02:26:35    ( SUCCESS )
        
using internal algorithm
read 1258291125 sectors
finding optimal blocksize
        
read 65536 sectors using a blocksize of 128 sectors  00:00:03    ( SUCCESS )
        
65536 of 65536 read
3.01886 seconds
read 65536 sectors using a blocksize of 256 sectors  00:00:03    ( SUCCESS )
        
65536 of 65536 read
3.70014 seconds
read 65536 sectors using a blocksize of 512 sectors  00:00:02    ( SUCCESS )
        
65536 of 65536 read
1.43703 seconds
read 65536 sectors using a blocksize of 1024 sectors  00:00:01    ( SUCCESS )
        
65536 of 65536 read
1.10518 seconds
read 65536 sectors using a blocksize of 2048 sectors  00:00:01    ( SUCCESS )
        
65536 of 65536 read
1.01409 seconds
read 65536 sectors using a blocksize of 4096 sectors  00:00:01    ( SUCCESS )
        
65536 of 65536 read
0.745188 seconds
read 65536 sectors using a blocksize of 8192 sectors  00:00:01    ( SUCCESS )
        
65536 of 65536 read
0.909588 seconds
read 65536 sectors using a blocksize of 16384 sectors  00:00:00    ( SUCCESS )
        
65536 of 65536 read
0.678442 seconds
read 65536 sectors using a blocksize of 32768 sectors  00:00:01    ( SUCCESS )
        
65536 of 65536 read
0.599121 seconds
read 65536 sectors using a blocksize of 65536 sectors  00:00:01    ( SUCCESS )
        
65536 of 65536 read
0.681358 seconds
optimal blocksize is 32768 sectors (16.00 MiB)
read 1257635765 sectors using a blocksize of 32768 sectors  02:26:21    ( SUCCESS )
        
1257635765 of 1257635765 read
1258291125 sectors read
perform real move  05:25:13    ( SUCCESS )
        
using internal algorithm
copy 1258291125 sectors
finding optimal blocksize
        
copy 65536 sectors using a blocksize of 64 sectors  00:00:04    ( SUCCESS )
        
65536 of 65536 copied
4.10719 seconds
copy 65536 sectors using a blocksize of 128 sectors  00:00:04    ( SUCCESS )
        
65536 of 65536 copied
3.84044 seconds
copy 65536 sectors using a blocksize of 256 sectors  00:00:05    ( SUCCESS )
        
65536 of 65536 copied
4.98139 seconds
copy 65536 sectors using a blocksize of 512 sectors  00:00:05    ( SUCCESS )
        
65536 of 65536 copied
4.77386 seconds
copy 65536 sectors using a blocksize of 1024 sectors  00:00:02    ( SUCCESS )
        
65536 of 65536 copied
2.7315 seconds
copy 65536 sectors using a blocksize of 2048 sectors  00:00:03    ( SUCCESS )
        
65536 of 65536 copied
2.87319 seconds
copy 65536 sectors using a blocksize of 4096 sectors  00:00:03    ( SUCCESS )
        
65536 of 65536 copied
2.41651 seconds
copy 65536 sectors using a blocksize of 8192 sectors  00:00:02    ( SUCCESS )
        
65536 of 65536 copied
2.02755 seconds
copy 65536 sectors using a blocksize of 16384 sectors  00:00:01    ( SUCCESS )
        
65536 of 65536 copied
1.61813 seconds
copy 65536 sectors using a blocksize of 32768 sectors  00:00:02    ( SUCCESS )
        
65536 of 65536 copied
1.49475 seconds
copy 65536 sectors using a blocksize of 65536 sectors  00:00:01    ( SUCCESS )
        
65536 of 65536 copied
1.39247 seconds
optimal blocksize is 65536 sectors (32.00 MiB)
copy 1257570229 sectors using a blocksize of 65536 sectors  05:24:41    ( SUCCESS )
        
1257570229 of 1257570229 copied
1258291125 sectors copied
move partition to the right  00:00:01    ( SUCCESS )
        
old start: 272960478
old end: 1531251602
old size: 1258291125 (600.00 GiB)
new start: 695228940
new end: 1953520064
new size: 1258291125 (600.00 GiB)
update boot sector of ntfs file system on /dev/sda5  00:00:00    ( SUCCESS )
check file system on /dev/sda5 for errors and (if possible) fix them  00:00:01    ( ERROR )
        
ntfsresize -P -i -f -v /dev/sda5
        
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sda5
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 860449116672 bytes (860450 MB)
Current device size: 644245056000 bytes (644246 MB)
ERROR: Current NTFS volume size is bigger than the device size!
Corrupt partition table or incorrect device partitioning?
libparted messages    ( INFO )
        
Error informing the kernel about modifications to partition /dev/sda4 -- Device or resource busy. This means Linux won't know about any changes you made to /dev/sda4 until you reboot -- so you shouldn't mount it or use it in any way before rebooting.
The kernel was unable to re-read the partition table on /dev/sda (Device or resource busy). This means Linux won't know anything about the modifications you made until you reboot. You should reboot your computer before doing anything with /dev/sda.

2

Re: [SOLVED] Move /dev/sda5 (NTFS) to the right and shrink it ERROR

With regard of the last message the log says

" Error informing the kernel about modifications to partition /dev/sda4 -- Device or resource busy. This means Linux won't know about any changes you made to /dev/sda4 until you reboot -- so you shouldn't mount it or use it in any way before rebooting.
The kernel was unable to re-read the partition table on /dev/sda (Device or resource busy). This means Linux won't know anything about the modifications you made until you reboot. You should reboot your computer before doing anything with /dev/sda."

I have tried to reboot and nothing happens, partition is not even recognized as NTFS.... I suspect it should be easy to correct this because all the process gone right thru....

Please boys, I need some help here!!!

3

Re: [SOLVED] Move /dev/sda5 (NTFS) to the right and shrink it ERROR

To fix this problem we will need the output from the following two commands:

fdisk -l -u

where one of the options is a lower case "L" and not a one.

parted /path-to-your-device unit s print

where /path-to-your-device is something like /dev/sda.

After you provide this information, I will provide additional commands that are needed to get copies of the Master Boot Record, and also the NTFS Partition Boot Record.

EDIT:
Since similar problems have been reported by other users, I have created a bug report in GParted:
GParted Bug #601574 - ERROR: Current NTFS volume size is bigger than the device size!

We can continue to solve your specific partition problem in this forum post.  The bug report will be used to solve the root problem in GParted.

4

Re: [SOLVED] Move /dev/sda5 (NTFS) to the right and shrink it ERROR

Are you using a Live CD?  If so which one and which version?

5

Re: [SOLVED] Move /dev/sda5 (NTFS) to the right and shrink it ERROR

Thank you very much gedakc ! I will reunite all this information soon and share it with you right here! big_smile

6 (edited by pablo.alonso 2009-11-12 16:14:44)

Re: [SOLVED] Move /dev/sda5 (NTFS) to the right and shrink it ERROR

Hi gedakc here I give you the information you requested me.

I used Live CD iso file downloaded from official site thru sourgeforce: gparted-live-0.4.8-1.iso

Result of fdisk -l -u command:


Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x1405cdc9

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63   212186519   106093228+   7  HPFS/NTFS
/dev/sda2       212186520   271755539    29784510   83  Linux
/dev/sda3       271755540   272960414      602437+  82  Linux swap / Solaris
/dev/sda4       272960477  1953525167   840282345+   f  W95 Ext'd (LBA)
/dev/sda5       695228940  1953520064   629145562+   7  HPFS/NTFS

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
16 heads, 63 sectors/track, 1938021 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0xf46176e3

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1              63  1953525167   976762552+   7  HPFS/NTFS

Disk /dev/sdc: 16.0 GB, 16001036288 bytes
32 heads, 63 sectors/track, 15501 cylinders, total 31252024 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x0000d5d8

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *          63    31250015    15624976+   b  W95 FAT32



Result of parted /dev/sda unit s print command:


Model: ATA WDC WD10EADS-00L (scsi)
Disk /dev/sda: 1953525168s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start       End          Size         Type      File system     Flags
1      63s         212186519s   212186457s   primary   ntfs            boot
2      212186520s  271755539s   59569020s    primary   ext4
3      271755540s  272960414s   1204875s     primary   linux-swap(v1)
4      272960477s  1953525167s  1680564691s  extended                  lba
5      695228940s  1953520064s  1258291125s  logical



Thank you !!!

Regards,
Pablo Alonso

7

Re: [SOLVED] Move /dev/sda5 (NTFS) to the right and shrink it ERROR

In this situation, I think the correct option is to change NTFS Partition Boot Record.  This is because we cannot have a file system starting at sector 695,228,940 that is 860449116672 bytes (1,680,564,681 sectors) in size.  That would require a drive size of 2,375,793,621 sectors when the drive is clearly only 1,953,525,168 in size smile.

To do this I will need a copy of the NTFS PBR.  You can capture the NTFS Partition Boot Record in a file with the following command:

NOTE:  Be extra careful to type this command in properly, otherwise loss of data could result.

dd if=/dev/sda of=sda5-pablo.pbr bs=512 count=1 skip=695228940

where sda5-pablo.pbr is the name of the file that will need to be uploaded.

Next upload the file to a media sharing site, such as mediafire, and post a link to it back here in this forum.

8

Re: [SOLVED] Move /dev/sda5 (NTFS) to the right and shrink it ERROR

Hi gedakc !

I understand the point, you make it to sound easy and I completely rely on you for this... haha

The file as you requested is right here for direct http download:
www.pa-itservices.com.ar/gparted/sda5-pablo.pbr

Thank you again.

Regards,
Pablo

9

Re: [SOLVED] Move /dev/sda5 (NTFS) to the right and shrink it ERROR

The change I have made to the file is from a length of 1,680,565,580 sectors:
00000020   00 00 00 00  80 00 80 00  C8 61 2B 64  00 00 00 00
To a new length of 1,258,291,124 sectors:
00000020   00 00 00 00  80 00 80 00  B4 FF FF 4A  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: sda5-pablo_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=sda5-pablo_new.pbr of=/dev/sda bs=512 count=1 seek=695228940

3) Reboot the computer

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


NOTE:  We are tracking a problem with GParted resizing file systems.  See post:
WARNING! Problem Resizing File Systems with GParted

10

Re: [SOLVED] Move /dev/sda5 (NTFS) to the right and shrink it ERROR

Hi gedakc, I've done the procedure untill step 3. I'm afraid of going further into step 4 since windows still doesn't recognize the partition as a valid NTFS FileSystem. not even Gparted. (it says Unknown)

Is this a bad news for me? I haven't done any change to the disk besides your strictly procedures posted here.

I hope we can still save it ...... please!

Thank you.

Regards,
Pablo

11

Re: [SOLVED] Move /dev/sda5 (NTFS) to the right and shrink it ERROR

Hmm... that is strange.  I rechecked my calculations and all looks good.

Would you be able to check with GParted Live 0.4.6-1?

If the problem still persists, would you be able to post files of both the Master Boot Record, and the NTFS Boot Record (again)?


You can capture the Master Boot Record in a file with the following command:

NOTE:  Be extra careful to type this command in properly, otherwise loss of data could result.

dd if=/dev/sda of=sda-pablo2.mbr bs=512 count=1

where sda-pablo2.mbr is the name of the file that will need to be uploaded.


You can capture the NTFS Partition Boot Record in a file as noted in post #7.  Please give this file a new name such as sda5-pablo2.pbr.


Then upload these files to a media sharing site and post the link to these files in this forum post.

12

Re: [SOLVED] Move /dev/sda5 (NTFS) to the right and shrink it ERROR

gedakc i owe you an appollogy.
Windows dont detect the part as ntfs but gparted after a reboot yes!
So i tried chkdsk anyway and seems to be ok now!
I couldnt try to copy nothing yet
im from my mobil rigth now and cant write further. Ill come back later
thanx

13

Re: [SOLVED] Move /dev/sda5 (NTFS) to the right and shrink it ERROR

No worries.  wink

Please do let me know if you are able to properly use the partition again.

14

Re: [SOLVED] Move /dev/sda5 (NTFS) to the right and shrink it ERROR

Hi gedakc !

Now I can write at full capability! in my full sized keyboard of desktop computer... haha
Sorry for that, but I was reaching late to university and simultaneously fifteen minutes before a strong rainfall come and after my first post I suddenly lost total internet connectivity at home. the ISP delayed six hours to fix whatever it caused the network shortage.

Anyway, I'm extremely happy to announce you that right now I'm coping all the information from the disk (you have saved me) after the Gparted resize failure operation. All the information seems to be ok and reliable. RAR files opens good, and pictures are also seen right. I think is everything ok now having done this simple checks.

All it was needed was to reboot after the last command you gave me "dd if=sda5-pablo_new.pbr of=/dev/sda bs=512 count=1 seek=695228940" to see the partition again as ntfs in Gparted and the reboot again with M$ operating system to do the repair with chkdsk tool. First try it fixed the partition type to be seen again as ntfs in diskpart and after a second reboot and the second chkdsk everything seem to be fixed!

Thank you very much, for all your time and good predisposition.
Gparted is a very good app and I hope you can improve it even more after this experience!

Best Regards,
Have a nice weekend!
Pablo Alonso

15

Re: [SOLVED] Move /dev/sda5 (NTFS) to the right and shrink it ERROR

I am glad to learn that your problem is solved smile

I will edit the first post and prefix it with "[SOLVED]" so that other users searching the forums will know which problems have been solved.

Have a great weekend too!