Using Knoppix and ntfsresize to enlarge a Windows XP partition

Written by James McDonald

November 8, 2007

The following is useful if you have say a 10GB C: drive and it’s on a larger Hard Disk and you would like to enlarge it.

I don’t go into the nitty gritty of using fdisk under Linux so it might be a bit abreviated if you’re a newbie.

  1. Boot from Knoppix CD
  2. Once booted into knoppix gain root and do the following
  3. Run fdisk and delete the Windows XP partition and recreate a partition as large as you want it (this can be the full size of the disk)
  4. Remember to reset the partition to a type of 07 and set the bootable flag
  5. run ntfsresize –info /dev/hda1 to get info on the disk
  6. run ntfsresize -v -s <sizeinbytes> /dev/hda1

Notes: I first tried to specify the partition size in MB and ntfsresize complained that I was trying to resize to a size bigger than the partition. Looking at the output carefully showed that I was specifying a partition with more bytes in it than the physical partition had even though they displayed the exact same MB size. I assume this was due to rounding so I switched to bytes and made it exactly the same as the partition bytes and ntfsresize ran without complaint.

Once this was complete I rebooted back into Windows and it ran a disk check.

Here is the raw commands I ran and their output.

root@Knoppix:~# ntfsresize –info /dev/hda1
ntfsresize v1.13.2-WIP (libntfs 10:0:0)
Device name : /dev/hda1
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 8389751296 bytes (8390 MB)
Current device size: 10737345024 bytes (10738 MB)
Checking filesystem consistency …
100.00 percent completed
Accounting clusters …
Space in use : 6646 MB (79.2%)
Collecting resizing constraints …
You might resize at 6645882880 bytes or 6646 MB (freeing 1744 MB).
Please make a test run using both the -n and -s options before real resizing!

ntfsresize -v -n -s 10737345024 /dev/hda1
ntfsresize v1.13.2-WIP (libntfs 10:0:0)
Device name : /dev/hda1
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 8389751296 bytes (8390 MB)
Current device size: 10737345024 bytes (10738 MB)
New volume size : 10737340928 bytes (10738 MB)
Checking for bad sectors …
Checking filesystem consistency …
100.00 percent completed
Accounting clusters …
Space in use : 6646 MB (79.2%)
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.

root@Knoppix:~# ntfsresize -v -s 10737345024 /dev/hda1
ntfsresize v1.13.2-WIP (libntfs 10:0:0)
Device name : /dev/hda1
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 8389751296 bytes (8390 MB)
Current device size: 10737345024 bytes (10738 MB)
New volume size : 10737340928 bytes (10738 MB)
Checking for bad sectors …
Checking filesystem consistency …
100.00 percent completed
Accounting clusters …
Space in use : 6646 MB (79.2%)
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])? y
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/hda1’

2 Comments

  1. ansong

    Wouldn’t deleting the partition necessitate reinstalling windows?

    Reply
    • admin

      No. When you delete the partition you are not damaging the Windows Install. Once the partition is deleted you immediately create a new partition and write this information to disk. The ntfsresize command then grabs the Windows install that was sitting on the old NTFS partition and rehomes it on the new larger or smaller partition depending if you chose to shrink or enlarge the partition.

      Obviously if you recreated a partition that was too small for the windows installation you would in effect corrupt the windows install and then you would have to re-install…

      I don’t recommend doing any partition resizing at all if you can’t recover from a known good backup.

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

You May Also Like…