Tuesday, May 22, 2012

Resizing NTFS Partition using gparted and chkdsk

Today I installed Ubuntu 12.04 on a Laptop which had Windows XP and Ubuntu 10.04 in dual boot and large extended NTFS partition on E:/ drive. First I tried to resize the NTFS partition using gparted of Ubuntu 10.04 but it failed and also made the NTFS partition unmountable on Ubuntu. I corrected the partition using testdisk and it became mountable. Then I decided to try gparted on Ubuntu 12.04 and successfully resize the partition as follows:
I inserted the usb Startup disk into usb port of the Laptop and booted into Ubuntu 12.04. Clicked on top left icon called Dash Home and searched for gparted and clicked on the gparted icon. I right clicked on the NTFS partition and selected check. As expected the gparted produced following error:
GParted 0.11.0 --enable-libparted-dmraid
Libparted 2.3
Check and repair file system (ntfs) on /dev/sda5  00:00:07    ( ERROR )
    
calibrate /dev/sda5  00:00:00    ( SUCCESS )
    
path: /dev/sda5
start: 204,796,683
end: 623,032,829
size: 418,236,147 (199.43 GiB)
check file system on /dev/sda5 for errors and (if possible) fix them  00:00:07    ( ERROR )
    
ntfsresize -P -i -f -v /dev/sda5
    
ntfsresize v2012.1.15AR.1 (libntfs-3g)
Device name : /dev/sda5
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 214136902144 bytes (214137 MB)
Current device size: 214136907264 bytes (214137 MB)
Checking for bad sectors ...
Checking filesystem consistency ...
Accounting clusters ...
Cluster accounting failed at 12408217 (0xbd5599): extra cluster in $Bitmap
Cluster accounting failed at 12408218 (0xbd559a): extra cluster in $Bitmap
Cluster accounting failed at 12408219 (0xbd559b): extra cluster in $Bitmap


Filesystem check failed! Totally 2576 cluster accounting mismatches.
ERROR: NTFS is inconsistent. Run chkdsk /f on Windows then reboot it TWICE!
The usage of the /f parameter is very IMPORTANT! No modification was
and will be made to NTFS by this software until it gets repaired.


Then I rebooted into Windows XP and opened command prompt

>chkdsk E: /f
The type of the file system is NTFS.
CHKDSK is verifying files (stage 1 of 3)...
File verification completed.
CHKDSK is verifying indexes (stage 2 of 3)...
Index verification completed.
CHKDSK is verifying security descriptors (stage 3 of 3)...
Security descriptor verification completed.
CHKDSK discovered free space marked as allocated in the volume bitmap.
Windows has made corrections to the file system.
209118068 KB total disk space.
51761464 KB in 45713 files.
19896 KB in 7661 indexes.
0 KB in bad sectors.
131132 KB in use by the system.
65536 KB occupied by the log file.
157205576 KB available on disk.
4096 bytes in each allocation unit.
52279517 total allocation units on disk.
39301394 allocation units available on disk.

Then I  rebooted twice in Windows XP.

Once again I booted into Ubuntu 12.04 using usb startup disk and started gparted, right clicked on the partition and selected check. This time gparted reported as follows:
GParted 0.11.0 --enable-libparted-dmraid
Libparted 2.3
Check and repair file system (ntfs) on /dev/sda5    ( SUCCESS )
    
calibrate /dev/sda5  00:00:00    ( SUCCESS )
    
path: /dev/sda5
start: 204,796,683
end: 623,032,829
size: 418,236,147 (199.43 GiB)
check file system on /dev/sda5 for errors and (if possible) fix them    ( SUCCESS )
    
ntfsresize -P -i -f -v /dev/sda5
    
ntfsresize v2012.1.15AR.1 (libntfs-3g)
Device name : /dev/sda5
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 214136902144 bytes (214137 MB)
Current device size: 214136907264 bytes (214137 MB)
Checking for bad sectors ...
Checking filesystem consistency ...
Accounting clusters ...
Space in use : 53159 MB (24.8%)
Collecting resizing constraints ...
Estimating smallest shrunken size supported ...
File feature Last used at By inode
$MFT : 162676 MB 0
Multi-Record : 170638 MB 27119
$MFTMirr : 107604 MB 1
Compressed : 42052 MB 30556
Ordinary : 168508 MB 26979
You might resize at 53158412288 bytes or 53159 MB (freeing 160978 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:00    ( SUCCESS )
    
run simulation  00:00:00    ( SUCCESS )
    
ntfsresize -P --force --force /dev/sda5 --no-action
    
ntfsresize v2012.1.15AR.1 (libntfs-3g)
Device name : /dev/sda5
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 214136902144 bytes (214137 MB)
Current device size: 214136907264 bytes (214137 MB)
New volume size : 214136902144 bytes (214137 MB)
Nothing to do: NTFS volume size is already OK.
real resize    ( ERROR )
    
ntfsresize -P --force --force /dev/sda5
    
ntfsresize v2012.1.15AR.1 (libntfs-3g)
Device name : /dev/sda5
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 214136902144 bytes (214137 MB)
Current device size: 214136907264 bytes (214137 MB)
New volume size : 214136902144 bytes (214137 MB)
Nothing to do: NTFS volume size is already OK.
Finally I could resize the NTFS partition and make a new ext4 partition to install Ubuntu 12.04.
















No comments:

Air India direct flight to San Fransisco has flown through China today.

 My sister in law left for San Fransisco by AI 173 flight which flows over North Pole. I tracked that flight on flightstats.com till it land...