Coolest Program of the Week: ntfsprogs
I’m running an old Pentium II with 333 MHz in my company, which provides me with the occasional Windows access, should the need arise. Since my company manages all PC through a centralized facility, which distributes and installs all updates and security patches, I recently received an email notification, that the PC in question doesn’t have enough free diskspace to install the XP Service Pack 2, which should be rolled out during August and September.
Due to whatever reasons XP was installed somewhat peculiar. The first disc is a 18 GB and the second disc the original 4 GB drive from the time, when the PC was new. XP was installed on a 6 Gb partition (drive C:) on the first drive and the remaining space was wasted with an unused FAT32 partition. The rest of the XP installation used a 2 GB partition on the second drive as D:. So, enough space was available, if it would have been properly used. So, to make room for the installation of SP2 some partition shuffling was required. Thanks to Knoppix and the ntfsprogs it all could be managed in the true fashion how Unix worked since the beginning of time.
First I booted Knoppix, obtained a root shell (sudo /bin/bash) and saved the two important XP partitions over the network onto a server, which acts as my Gentoo compile host. I used this command line modelled after an example from the ntfsclone man-page.
ntfsclone --save-image --output - /dev/sda? | \\
ssh -lroot -p7003 host "cat > part-?.img"
I didn’t use the gzip for compression in between the pipeline, since this slowed the 333MHz PC significantly down and the -lroot and -p7003 were only necessary, since the destination host was hidden behind an IPCOP firewall. Then QtParted was used to repartition the 18 GB drive to create two equally sized partitions. The NTFS file system on the C: drive was immediately resized by QtParted and was therefore directly usable. Next step was to restore the D: drive on the first drive. I did it over the network, but I could have done this directly by copying from the second to the first drive. Anyway, this command line was used for the restoration of the D: drive.
ssh -lroot -p7003 host "cat part-d.img" | \\
ntfsclone --restore-image --overwrite /dev/sda2 -
Although the second partition was about 9 GB the restored NTFS file system was still 2 GB in size. The ntfsresize resized the NTFS file system to use the complete partition.
ntfsresize /dev/sda2
did it. After rebooting I already had the newly resized C: drive online, but the D: drive was still connected to the old partition on the second drive. At this point the XP drive management needed to be started to reassign the D: drive. That was it. One additional reboot and the PC was ready for XP SP2.
Knoppix is already known for it’t coolness, but the ntfsprogs get my vote for the coolest programs of this week.





