1

Topic: error while shrinking and shifting partition on ext hdd - data lost?

Hey all,

I'm a new user of GParted. I attempted to use the version in PartedMagic included on the UltimateBootCD 5 rc1. While trying to shrink and shift a partition, I received an error and can no longer read the data on the harddrive.

I feel like it shouldn't be too difficult to recover most of my data, but so far my efforts haven't gotten me anywhere. Any help with this would be much appreciated!


more info:
-the partition spanned a 250GB external hdd, and I was attempting to shrink it and shift it (accidentally set it to shift) a bit.
-I was using the gui for Gparted, on PartedMagic using Xvesa
-I know that the operation had at least reached the 'moving data' step. At that point I left it to run over night since the time left was a few hours.

I've tried to recover the partition using TestDisk (also included in PartedMagic) and ran into this:

search_part() 
Disk /dev/sdc - 251 GB / 233 GiB - CHS 30516 255 63 
NTFS at 0/1/1 
filesystem size 490232505 
sectors_per_cluster 8 
mft_lcn 786432 
_lcn 30638963 
clusters_per_mft_record -10 
clusters_per_index_record 1 
    HPFS - NTFS 0 1 1 30515 144 21 490232505 
    NTFS, 250 GB / 233 GiB
NTFS at 7/0/1 
filesystem size 490232505 
sectors_per_cluster 8 
mft_lcn 786432 
mftmirr_lcn 30638963 
clusters_per_mft_record -10 
clusters_per_index_record 1 
    HPFS - NTFS 7 0 1 30522 143 21 490232505 [NK's HD ] 
    NTFS, 250 GB / 233 GiB 
This partition ends after the disk limits. (start=112455, size=490232505, end=490344959, disk end=490239540) 
Search for partition aborted 
Disk /dev/sdc - 251 GB / 233 GiB - CHS 30516 255 63 
Check the harddisk size: HD jumpers settings, BIOS detection... 
The harddisk (251 GB / 233 GiB) seems too small! (< 251 GB / 233 GiB) 
The following partition can't be recovered: 
    HPFS - NTFS 7 0 1 30522 143 21 490232505 [NK's HD ] 
    NTFS, 250 GB / 233 GiB

It seems as though the table was shifted before it was adjusted for the shrink. I'm not sure how to fix this..

Any ideas?
Or even just advice on how I can recover my data at this point?

2

Re: error while shrinking and shifting partition on ext hdd - data lost?

What error did you receive?  If you saved the gparted_details.htm log file, please post it here as that helps greatly in troubleshooting problems.

3

Re: error while shrinking and shifting partition on ext hdd - data lost?

I was in a rush when I saw the error and unfortunately someone had shutdown the computer before I returned. I'm assuming the log file is gone for good since this was from a live CD and run from ram... 

What directory would it be in anyway? I'll have a look in case there's some magic involved.

4

Re: error while shrinking and shifting partition on ext hdd - data lost?

You are correct.  When running from a Live CD, the file system is in RAM so a shutdown means all files stored to the live image file system are now gone.  ;-(

Do you know if the crash occurred during the resize or during the move?  If move, which way were you moving the file system (left/right)?

If you do not have a backup of your files, you might look into PhotoRec to try to recover files.

5

Re: error while shrinking and shifting partition on ext hdd - data lost?

Found it!! looks like the details were saved to my harddrive.

GParted 0.4.7-git

Libparted 1.9.0

Move /dev/sdc1 to the right and shrink it from 233.76 GiB to 180.00 GiB  05:13:55    ( ERROR )
        
calibrate /dev/sdc1  00:00:00    ( SUCCESS )
        
path: /dev/sdc1
start: 63
end: 490232575
size: 490232513 (233.76 GiB)
calculate new size and position of /dev/sdc1  00:00:01    ( SUCCESS )
        
requested start: 112455
requested end: 377591759
requested size: 377479305 (180.00 GiB)
new start: 112455
new end: 377591759
new size: 377479305 (180.00 GiB)
check file system on /dev/sdc1 for errors and (if possible) fix them  00:00:01    ( SUCCESS )
        
ntfsresize -P -i -f -v /dev/sdc1
        
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sdc1
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 250999046656 bytes (251000 MB)
Current device size: 250999046656 bytes (251000 MB)
Checking for bad sectors ...
Checking filesystem consistency ...
Accounting clusters ...
Space in use : 97308 MB (38.8%)
Collecting resizing constraints ...
Estimating smallest shrunken size supported ...
File feature Last used at By inode
$MFT : 3239 MB 0
Multi-Record : 247907 MB 25
$MFTMirr : 125498 MB 1
Compressed : 3153 MB 449
Ordinary : 250754 MB 5420
You might resize at 97307037696 bytes or 97308 MB (freeing 153692 MB).
Please make a test run using both the -n and -s options before real resizing!
shrink file system  00:24:15    ( SUCCESS )
        
run simulation  00:00:06    ( SUCCESS )
        
ntfsresize -P --force /dev/sdc1 -s 193269404159 --no-action
        
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sdc1
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 250999046656 bytes (251000 MB)
Current device size: 250999046656 bytes (251000 MB)
New volume size : 193269400064 bytes (193270 MB)
Checking filesystem consistency ...
Accounting clusters ...
Space in use : 97308 MB (38.8%)
Collecting resizing constraints ...
Needed relocations : 4440701 (18190 MB)
Schedule chkdsk for NTFS consistency check at Windows boot time ...
Resetting $LogFile ... (this might take a while)
Relocating needed data ...
Updating $BadClust file ...
Updating $Bitmap file ...
Updating Boot record ...
The read-only test run ended successfully.
real resize  00:24:09    ( SUCCESS )
        
ntfsresize -P --force /dev/sdc1 -s 193269404159
        
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sdc1
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 250999046656 bytes (251000 MB)
Current device size: 250999046656 bytes (251000 MB)
New volume size : 193269400064 bytes (193270 MB)
Checking filesystem consistency ...
Accounting clusters ...
Space in use : 97308 MB (38.8%)
Collecting resizing constraints ...
Needed relocations : 4440701 (18190 MB)
Schedule chkdsk for NTFS consistency check at Windows boot time ...
Resetting $LogFile ... (this might take a while)
Relocating needed data ...
Updating $BadClust file ...
Updating $Bitmap file ...
Updating Boot record ...
Syncing device ...
Successfully resized NTFS on device '/dev/sdc1'.
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 233.76 GiB to 180.00 GiB  00:00:00    ( SUCCESS )
        
old start: 63
old end: 490232575
old size: 490232513 (233.76 GiB)
new start: 63
new end: 377479367
new size: 377479305 (180.00 GiB)
check file system on /dev/sdc1 for errors and (if possible) fix them  00:00:02    ( SUCCESS )
        
ntfsresize -P -i -f -v /dev/sdc1
        
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sdc1
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 193269400064 bytes (193270 MB)
Current device size: 250999046656 bytes (251000 MB)
Checking for bad sectors ...
Checking filesystem consistency ...
Accounting clusters ...
Space in use : 97306 MB (50.3%)
Collecting resizing constraints ...
Estimating smallest shrunken size supported ...
File feature Last used at By inode
$MFT : 3239 MB 0
Multi-Record : 192687 MB 25
$MFTMirr : 125498 MB 1
Compressed : 3153 MB 449
Ordinary : 192605 MB 5420
You might resize at 97305272320 bytes or 97306 MB (freeing 95964 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:05    ( SUCCESS )
        
run simulation  00:00:03    ( SUCCESS )
        
ntfsresize -P --force /dev/sdc1 --no-action
        
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sdc1
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 193269400064 bytes (193270 MB)
Current device size: 250999046656 bytes (251000 MB)
New volume size : 250999042560 bytes (251000 MB)
Checking filesystem consistency ...
Accounting clusters ...
Space in use : 97306 MB (50.3%)
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:02    ( SUCCESS )
        
ntfsresize -P --force /dev/sdc1
        
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sdc1
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 193269400064 bytes (193270 MB)
Current device size: 250999046656 bytes (251000 MB)
New volume size : 250999042560 bytes (251000 MB)
Checking filesystem consistency ...
Accounting clusters ...
Space in use : 97306 MB (50.3%)
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/sdc1'.
calculate new size and position of /dev/sdc1  00:00:00    ( SUCCESS )
        
requested start: 112455
requested end: 377591759
requested size: 377479305 (180.00 GiB)
new start: 112455
new end: 377591759
new size: 377479305 (180.00 GiB)
check file system on /dev/sdc1 for errors and (if possible) fix them  00:00:01    ( SUCCESS )
        
ntfsresize -P -i -f -v /dev/sdc1
        
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sdc1
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 250999042560 bytes (251000 MB)
Current device size: 250999046656 bytes (251000 MB)
Checking for bad sectors ...
Checking filesystem consistency ...
Accounting clusters ...
Space in use : 97308 MB (38.8%)
Collecting resizing constraints ...
Estimating smallest shrunken size supported ...
File feature Last used at By inode
$MFT : 3239 MB 0
Multi-Record : 192687 MB 25
$MFTMirr : 125498 MB 1
Compressed : 3153 MB 449
Ordinary : 192605 MB 5420
You might resize at 97307037696 bytes or 97308 MB (freeing 153692 MB).
Please make a test run using both the -n and -s options before real resizing!
move file system to the right  04:49:29    ( SUCCESS )
        
perform read-only test  01:31:06    ( SUCCESS )
        
using internal algorithm
read 377479305 sectors
finding optimal blocksize
        
read 65536 sectors using a blocksize of 128 sectors  00:00:04    ( SUCCESS )
        
65536 of 65536 read
3.79767 seconds
read 65536 sectors using a blocksize of 256 sectors  00:00:04    ( SUCCESS )
        
65536 of 65536 read
3.76744 seconds
read 65536 sectors using a blocksize of 512 sectors  00:00:03    ( SUCCESS )
        
65536 of 65536 read
2.78391 seconds
read 65536 sectors using a blocksize of 1024 sectors  00:00:01    ( SUCCESS )
        
65536 of 65536 read
1.75386 seconds
read 65536 sectors using a blocksize of 2048 sectors  00:00:02    ( SUCCESS )
        
65536 of 65536 read
1.66068 seconds
read 65536 sectors using a blocksize of 4096 sectors  00:00:01    ( SUCCESS )
        
65536 of 65536 read
1.45222 seconds
read 65536 sectors using a blocksize of 8192 sectors  00:00:02    ( SUCCESS )
        
65536 of 65536 read
1.482 seconds
read 65536 sectors using a blocksize of 16384 sectors  00:00:01    ( SUCCESS )
        
65536 of 65536 read
1.47061 seconds
read 65536 sectors using a blocksize of 32768 sectors  00:00:02    ( SUCCESS )
        
65536 of 65536 read
1.56845 seconds
read 65536 sectors using a blocksize of 65536 sectors  00:00:01    ( SUCCESS )
        
65536 of 65536 read
1.43869 seconds
optimal blocksize is 65536 sectors (32.00 MiB)
read 376823945 sectors using a blocksize of 65536 sectors  01:30:45    ( SUCCESS )
        
376823945 of 376823945 read
377479305 sectors read
perform real move  03:18:23    ( SUCCESS )
        
using internal algorithm
copy 377479305 sectors
finding optimal blocksize
        
copy 65536 sectors using a blocksize of 64 sectors  00:00:07    ( SUCCESS )
        
65536 of 65536 copied
7.00829 seconds
copy 65536 sectors using a blocksize of 128 sectors  00:00:07    ( SUCCESS )
        
65536 of 65536 copied
6.36525 seconds
copy 65536 sectors using a blocksize of 256 sectors  00:00:05    ( SUCCESS )
        
65536 of 65536 copied
5.35203 seconds
copy 65536 sectors using a blocksize of 512 sectors  00:00:04    ( SUCCESS )
        
65536 of 65536 copied
4.2944 seconds
copy 65536 sectors using a blocksize of 1024 sectors  00:00:04    ( SUCCESS )
        
65536 of 65536 copied
3.6339 seconds
copy 65536 sectors using a blocksize of 2048 sectors  00:00:03    ( SUCCESS )
        
65536 of 65536 copied
2.98459 seconds
copy 65536 sectors using a blocksize of 4096 sectors  00:00:03    ( SUCCESS )
        
65536 of 65536 copied
2.50211 seconds
copy 65536 sectors using a blocksize of 8192 sectors  00:00:02    ( SUCCESS )
        
65536 of 65536 copied
2.29807 seconds
copy 65536 sectors using a blocksize of 16384 sectors  00:00:02    ( SUCCESS )
        
65536 of 65536 copied
2.34165 seconds
copy 65536 sectors using a blocksize of 32768 sectors  00:00:03    ( SUCCESS )
        
65536 of 65536 copied
2.39528 seconds
copy 65536 sectors using a blocksize of 65536 sectors  00:00:02    ( SUCCESS )
        
65536 of 65536 copied
2.48984 seconds
optimal blocksize is 8192 sectors (4.00 MiB)
copy 376758409 sectors using a blocksize of 8192 sectors  03:17:41    ( SUCCESS )
        
376758409 of 376758409 copied
377479305 sectors copied
move partition to the right  00:00:01    ( SUCCESS )
        
old start: 63
old end: 377479367
old size: 377479305 (180.00 GiB)
new start: 112455
new end: 377591759
new size: 377479305 (180.00 GiB)
update boot sector of ntfs file system on /dev/sdc1  00:00:00    ( SUCCESS )
check file system on /dev/sdc1 for errors and (if possible) fix them  00:00:00    ( ERROR )
        
ntfsresize -P -i -f -v /dev/sdc1
        
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sdc1
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 250999042560 bytes (251000 MB)
Current device size: 193269404160 bytes (193270 MB)
ERROR: Current NTFS volume size is bigger than the device size!
Corrupt partition table or incorrect device partitioning?
========================================

Create Primary Partition #1 (ntfs, 53.71 GiB) on /dev/sdc
========================================

Move /dev/sdc1 to the left and grow it from 180.00 GiB to 180.05 GiB
========================================

according to the details, the error occurred while checking the filesystem after updating the boot sector.

Also, since I needed the harddrive to backup some important data on another drive that may be failing, I decided to abandon the lost data and reformat the ext hdd. I tried to format it from my Windows machine and that failed...

6

Re: error while shrinking and shifting partition on ext hdd - data lost?

I also noticed something strange. When attempting to format, my windows pc thought the hdd was only 233gb, but when I plug it into my ubuntu laptop the disk utility recognizes that its 251gb...

7

Re: error while shrinking and shifting partition on ext hdd - data lost?

Thank you for providing the gparted_details.htm log file.  The version of GParted (0.4.7-git) is very old and the "-git" indicates that the version is not an official release, and may include an unknown number of changes that were to be bundled into 0.4.8.  We recommend using the latest version of GParted (currently 0.20.0).

From the log output, it appears that you encountered the following old bug:

WARNING! Problem Resizing File Systems with GParted

Since you reformatted I assume that you do not need help to recover the data.