Search

Recent Posts

Tags


« | Main | »

Whoops – restoring NTFS partitions…

By Dale Reagan | October 15, 2008

Hmm, remember the 3 B’s? (backup! backup! backup!)

During my exploration of Cobbler, Virtual Systems (Xen, Qemu, Virtual Box, others) and various Linux distributions I used my laptop which also contained a native XP install. Things went really well using Cobbler to setup various types of Kickstart files (full install, just a base install, web server install, etc.)

At some point I used the wrong option (in a kickstart file) for disk partitioning and, whoops, the XP install was gone…

While this sounds bad it really was not – all data had already been copied from the laptop disk and I did have a vendor restore disk (somewhere…)   The vendor recovery disk consisted of three ‘ghosted’ CD images – the restore, while time-consuming (~20 minutes), was simple.  After the restore it only took three-four reboots to get the laptop XP install up to current status (download updates from Microsoft, install, reboot-install, etc.)

Ok, after the install I used Knoppix (Linux LiveCD) and ‘gparted’ to ‘shrink’ the drive (since the factory/vendor restore uses the entire disk.)  After the ‘drive shrink’ I create new partitions to use with the next Linux install.

Ok, now I decide to create a backup of the XP partition – what to use?  At first I thought I would just try the venerable ‘dd’ command.  Before taking that approach I decided to search a bit – then i found ntfsclone.  Hmm, ntfsclone was installed on the version of Knoppix that I was using so I attached an external USB drive, mounted the disk, created a folder on the USB drive for backups and issued the command:

ntfsclone -s /dev/hda1 -O /mnt/usb_drive/backups/laptop.ntfs.img

This saved the disk image in a special format (a sparse image) which uses less space (via compression) than the physical drive.  Some bonuses for this type of ‘backup:

  1. the image allows a fixed restore point
  2. the image can be restored in less time than taking the vendor tool approach (when you consider the time to update, reboot, update, etc.)
  3. the image becomes as flexible as a virtual machine (VM) disk image – it could be restored to any disk so this tool provides a means to restore an entire disk

Ok, confident that I now have a backup (well, I will be after I do a test restore of the image) I proceed to initiate another install via Cobbler (thinking that I ‘fixed’ my kickstart-blows-away-the-disk problem.)

I reboot the laptop and, whooops, stuck at a bad Grub boot message – apparantely I should have created the clone image prior to other OS tinkering.  This process (boot sector backups) is explored in another post discussing Vista boot options (using dd to copy Vista boot sector images – the steps for Xp sill be similar but I’m going to stick with using a Cobbler install for now.)

Using Knoppix to re-create partition tables (via gpartd) and then mounting the USB drive, the restore of the cloned ~20GB NTFS partition from USB drive took ~11.5 minutes.

ntfsclone -r /mnt/usb_drive/backups/laptop.ntfs.img -O /dev/hda1

WARNING – don’t use these techniques on production systems/disk unless you are comfortable doing so – data may be lost.  Always start with the three B’s!

Topics: Computer Technology, Unix-Linux-Os, Web Problem Solving | Comments Off on Whoops – restoring NTFS partitions…

Comments are closed.


________________________________________________
YOUR GeoIP Data | Ip: 73.21.121.1
Continent: NA | Country Code: US | Country Name: United States
Region: | State/Region Name: | City:
(US only) Area Code: 0 | Postal code/Zip:
Latitude: 38.000000 | Longitude: -97.000000
Note - if using a mobile device your physical location may NOT be accurate...
________________________________________________

Georgia-USA.Com - Web Hosting for Business
____________________________________