-->
Articles - Nishant Sharma Online
>> Resize NTFS partition using ntfstools on Ubuntu Linux Live CD
 
 
Google
Web nishants.net
IP Address Location
Resize NTFS partition using ntfstools on Ubuntu Linux Live CD
Disclaimer: I don't take responsibilty of any sorts for whatsoever damage that might be caused by following these instructions. It is advised that you should back up all your data before performing any resize operations on your filesystem.

You have got Windows XP/2000 installed on your machine with NTFS filesystem. Now, you want to install GNU/Linux also but still want to keep your Windows partition for some reason(s). Here is a sweet and simple way to do it using ntfstools. Although, I've done it on Ubuntu Warty Warthog Live CD, you can use any live GNU/Linux CD along with compatible libntfs and ntfstools packages.

  1. Boot into Windows and download ntfstools and libntfs deb packages.

  2. Defragment the filesystem while you are in Windows. And then shutdown.

  3. Use Ubuntu CD and boot from it into GNU/Linux. Press ALT-F2 and run:
    xterm
    Become root:
    $ sudo bash
    Mount the Windows partition:
    # mount /dev/hda1 /mnt/hda1

  4. Change the directory to where you've downloaded deb packages on Windows partition:
    # cd /mnt/hda1/path/to/deb/packages

  5. Install the packages:
    # dpkg -i libntfs5_1.9.0-1_i386.deb ntfstools_1.9.0-1_i386.deb

  6. Unmount the Windows partition:
    # umount /mnt/hda1

  7. For more simplicity, if you have access to the internet, you could have bypassed steps 1 to 6 and instead used:
    # apt-get install ntfstools

  8. This command will show you the minimum partition size to which it can be shrunk:
    # ntfsresize -if /dev/hda1

    ntfsresize v1.9.4
    NTFS volume version: 3.1
    Cluster size       : 4096 bytes
    Current volume size: 31999996416 bytes (32000 MB)
    Current device size: 32078559744 bytes (32079 MB)
    Checking filesystem consistency ...
    100.00 percent completed
    Accounting clusters ...
    Space in use       : 12790 MB (40.0%)
    Collecting shrinkage constrains ...
    Estimating smallest shrunken size supported ...
    File feature         Last used at      By inode
    $MFT               :      3343 MB             0
    Multi-Record       :     20597 MB         19865
    You might resize at 12789129216 bytes or 12790 MB (freeing 19210 MB).
    Please make a test run using both the -n and -s options before real resizing!
    

  9. It says we can safely shrink the filesystem to 12790MB. Say, we want to make NTFS partition size as 15G, we'll run:
    # ntfsresize -f -s 15G /dev/hda1

    ntfsresize v1.9.4
    NTFS volume version: 3.1
    Cluster size       : 4096 bytes
    Current volume size: 31999996416 bytes (32000 MB)
    Current device size: 32078559744 bytes (32079 MB)
    New volume size    : 14999994880 bytes (15000 MB)
    Checking filesystem consistency ...
    100.00 percent completed
    Accounting clusters ...
    Space in use       : 12790 MB (40.0%)
    Collecting shrinkage constrains ...
    Needed relocations : 691084 (2831 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 ...
    

  10. We've successfully shrunk the filesystem, now we've to resize the partition accordingly. You can use your favourite partitioning tool like fdisk, cfdisk, sfdisk etc. The only precaution that needs to be taken is to keep the starting cylinder of the partition same as original. Also, the partition should be 20-200MB larger than the size of the shrunk filesystem. We can safely chose our partition size as 15200MB as our filesystem is of 15000MB. And, don't forget to set the bootable flag ON for the NTFS partition or you will not be able to boot into the Windows.

  11. ntfsresize marks the filesystem dirty and forces chkdsk to be run on the reboot. Reboot the machine into Windows, and you should see chkdsk running on the blue screen.

Your machine is ready with the free disk space to install GNU/Linux of the flavour of your choice on it.

For comments and feedback: nishantsharma [dot] in [at] gmail [dot] com



© Nishant Sharma. Some rights reserved.