1 (edited by ninetendoo 2017-02-06 02:37:11)

Topic: Messed up NTFS partition with resizing

Hey!

I tried to resize an NTFS partition (/dev/sda8 labeled Storage), GParted threw and error and now the NTFS partition is broken. The unallocated data at the end of the disk is supposed to be before /dev/sda8.

GParted printscreen: http://imgur.com/a/r5Oll

GParted 0.25.0 --enable-libparted-dmraid --enable-online-resize

Libparted 3.2
Move /dev/sda8 to the right and shrink it from 221.62 GiB to 165.77 GiB  00:14:25    ( ERROR )
        
calibrate /dev/sda8  00:00:02    ( SUCCESS )
        
path: /dev/sda8 (partition)
start: 512002048
end: 976773119
size: 464771072 (221.62 GiB)
check file system on /dev/sda8 for errors and (if possible) fix them  00:00:09    ( SUCCESS )
        
ntfsresize -i -f -v /dev/sda8  00:00:09    ( SUCCESS )
        
ntfsresize v2015.3.14AR.1 (libntfs-3g)
Device name : /dev/sda8
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 237962785280 bytes (237963 MB)
Current device size: 237962788864 bytes (237963 MB)
Checking for bad sectors ...
Checking filesystem consistency ...
100.00 percent completed
Accounting clusters ...
Space in use : 119558 MB (50.2%)
Collecting resizing constraints ...
Estimating smallest shrunken size supported ...
File feature Last used at By inode
Multi-Record : 237381 MB 454171
$MFTMirr : 1 MB 1
Sparse : 114323 MB 6852
Ordinary : 237963 MB 454173
You might resize at 119557873664 bytes or 119558 MB (freeing 118405 MB).
Please make a test run using both the -n and -s options before real resizing!
shrink file system  00:14:07    ( SUCCESS )
        
run simulation  00:00:44    ( SUCCESS )
        
ntfsresize --force --force -s 177995776000 --no-action /dev/sda8  00:00:44    ( SUCCESS )
        
ntfsresize v2015.3.14AR.1 (libntfs-3g)
Device name : /dev/sda8
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 237962785280 bytes (237963 MB)
Current device size: 237962788864 bytes (237963 MB)
New volume size : 177995772416 bytes (177996 MB)
Checking filesystem consistency ...
100.00 percent completed
Accounting clusters ...
Space in use : 119558 MB (50.2%)
Collecting resizing constraints ...
Needed relocations : 4896757 (20058 MB)
Schedule chkdsk for NTFS consistency check at Windows boot time ...
Resetting $LogFile ... (this might take a while)
Relocating needed data ...
100.00 percent completed
Updating $BadClust file ...
Updating $Bitmap file ...
Updating Boot record ...
The read-only test run ended successfully.
real resize  00:13:23    ( SUCCESS )
        
ntfsresize --force --force -s 177995776000 /dev/sda8  00:13:23    ( SUCCESS )
        
ntfsresize v2015.3.14AR.1 (libntfs-3g)
Device name : /dev/sda8
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 237962785280 bytes (237963 MB)
Current device size: 237962788864 bytes (237963 MB)
New volume size : 177995772416 bytes (177996 MB)
Checking filesystem consistency ...
100.00 percent completed
Accounting clusters ...
Space in use : 119558 MB (50.2%)
Collecting resizing constraints ...
Needed relocations : 4896757 (20058 MB)
Schedule chkdsk for NTFS consistency check at Windows boot time ...
Resetting $LogFile ... (this might take a while)
Relocating needed data ...
100.00 percent completed
Updating $BadClust file ...
Updating $Bitmap file ...
Updating Boot record ...
Syncing device ...
Successfully resized NTFS on device '/dev/sda8'.
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 221.62 GiB to 165.77 GiB  00:00:07    ( SUCCESS )
        
old start: 512002048
old end: 976773119
old size: 464771072 (221.62 GiB)
new start: 512002048
new end: 859650047
new size: 347648000 (165.77 GiB)
check file system on /dev/sda8 for errors and (if possible) fix them  00:00:00    ( ERROR )
        
ntfsresize -i -f -v /dev/sda8  00:00:00    ( ERROR )
        
ntfsresize v2015.3.14AR.1 (libntfs-3g)
ntfs_attr_pread_i: ntfs_pread failed: Input/output error
Failed to calculate free MFT records: Input/output error
ERROR: Failed to update the free space

========================================

Please help me!
Thank you!

2

Re: Messed up NTFS partition with resizing

Thanks for attaching the gparted_details.htm log file.  It is a great help to understand what went wrong.

It looks like the operation was able to shrink the NTFS file system, but failed the FS check before proceeding to move the NTFS file system to a new location.

Based on this, all your data should still be on the disk.

The error message appears to indicate a problem with the ntfsresize command which is a part of the ntfs-3g package.  Because ntfsresize v2015.3.14AR.1 is relatively old, I suggest trying the latest GParted Live to shrink the right edge of the partition by 8 MiB.  This should force another check, which might work with a newer version of the ntfs-3g package.

Of course before proceeding with any partition editing actions, it is highly recommended to make a backup of all your data.