Cloning NTFS partitions at the file level (and booting them)

August 2008


Table of Contents

Introduction
Expectations
The experiment
Conclusion
Post-Clone script for Windows XP in U/SWP

As the title of this document shows, I consider myself the Apprentice. The Guru[44] has created BootLeg, system cloning software that clones systems not at the filesystem, but at the file level. Please take a moment to consider the effects of this subtlety. Most disk/partition cloning software requires that the sizes of restored partitions are identical to the original. This is no problem with backup/restore operations, but for deployment of OS'es it becomes inconvenient, as different hardware soon forces the administrator to keep another image for that particular hardware.

BootLeg works at a higher level, and doesn't suffer from this drawback. As it images files into tar bundles, it allows you to restore them to any size partitions, or even to restore multiple images to a single partition, as long as the partition is large enough to hold all files in the image(s)[45].

This method has worked perfectly for years, producing way fewer errors than unattended installs do, and it would be a good way to install thousands of more-or-less identical machines. But it has two limitations: it works only with file systems that Linux reads and writes well, and only with bootloaders that can read filesystems, as the locations on restored partitions of files needed for boot may differ wildly from the original. For these reasons, it was particularly hard to incorporate the cloning of Windows XP into the tool, as this would involve NTFS filesystems, which Linux didn't read all that well. Even cloning an NTFS partition sector-by-sector was hard, as Windows stores information about the disk geometry in the partition's boot sector, and NTLDR uses that information.

The advent of NTFS-3G, brought writable NTFS within Linux range, and so I investigated whether it is possible to apply the BootLeg tarbundle method to clone NTFS file systems from Linux. If it is, we have an advantage over NtfsClone, which suffers the same disadvantages other filesystem cloners do, as it assumes too many similarities when used for deployment. Although relocntfs could help, it seems to be too immature and unmaintained to be put in a production environment. NTFSResize from the NTFSprogs suite could help, but then again the NTFS-3G developers criticize the NTFSprogs developers for breaking the FS sometimes (ToDo: citation needed).



[44] Credit where credit is due

[45] And as long as you handle differring partition numbers -if any- after imaging.