Diary of a Network Geek

The trials and tribulations of a Certified Novell Engineer who's been stranded in Houston, Texas.

11/7/2007

Linux-based PC Imaging, Part Two

Filed under: Fun Work,Geek Work,GUI Center,Linux,MicroSoft — Posted by the Network Geek during the Hour of the Rooster which is in the early evening or 6:22 pm for you boring, normal people.
The moon is Waning Crescent

This time, we’ll restore the image we made last time

mkdir /tmp/server
mount -t smbfs -o username=my_user_name   //server_name/share /tmp/server

Now, this assumes that you don’t have anything installed on the new pc yet and are working with just a blank, unformatted hard drive. First, I restored the partition table and the master boot record:
# sfdisk /dev/sda < /tmp/server/images/cad1r-sfdisk-sda.dump
# dd if=/tmp/server/images/cad1-sda.mbr of=/dev/sda

And then the partitions. Since I had several files produced by split for my primary partition, I needed to take them all, in the right order of course. Now, keep in mind that when we used split in the last post, it added “aa”, “ab”, “ac”, etc. to the end of the file name.

# ls -l /tmp/server

will help you check which files you need for the next step.

Now, again, this all assumes that you had a single partition on the original machine and are restoring a single partition. First, change to the directory where the images are:

cd /tmp/server

Now, we restore the image files with the command below. You’ll have to “cat” all the files in the image directory on the server. Notice the pattern of the file names? That’s what split did for us. Now, rather than do the work manually to restore them, I used a little bit of shell code and a variable reference to save you the need to type the names of all the files. Also, the little “-” at the end of the line does matter, so don’t forget it. Oh, and this command should all be on one line.

cat cad1-sda1.img.gz_a[a-z] | gunzip -c | ntfsclone --restore-image --overwrite /dev/sda1 -

Reboot into your new Windows XP clone.
It’s just like magic, isn’t it?

1 Comment

  1. Okay, so I’ve been using this restore process for a bit now and I’ve found a couple things to keep in mind.

    First, the best thing is to make the image on a disk smaller than you’ll use. You can expand the partition to be larger, but it’s impossible to shrink the image into a smaller drive.
    Second, you will need to tweak hardware.
    Third, you almost certainly will need to reregister Windows and any other software that generates license or activation codes based on hardware. Not a big deal, but better be prepared for it.

    Comment by the Network Geek — 11/26/2007 @ 1:31 pm

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.


Powered by WordPress
Any links to sites selling any reviewed item, including but not limited to Amazon, may be affiliate links which will pay me some tiny bit of money if used to purchase the item, but this site does no paid reviews and all opinions are my own.