Someday I was given the task to fix a problematic Windows XP Pro (used as a server, but let's supersede...), with a scratchy hdd.

I checked this HDD with Crystal Disk Info and the report was preoccupying to say the least.

After trying to boot the system, I got some BSODs and chkdsk wasn't able to finish the checks.

So I decided to clone the broken data to an image, then restore the image to a new hdd.

I knew I coulda used Acronis and such "for pay tools", but I needed to justify my salary and I had an Ubuntu box to play with.

After some reasearch on the topic, I gathered some helpful information which allowed me to accomplish this task.

The cloning procedure.

I plugged the faulty hdd on my Ubuntu box and, as soon as ubby booted, I opened a sudo prompt and typed the following nice commands on my terminal (you'll have to know where your NTFS hdd is mapped to: check your fstab, launch "blkid" and/or this "dmesg | egrep '(s|h)d[a-z]'"):

sfdisk -d /dev/sdb > /mnt/sda1/sdb-partition-table.dmp
dd if=/dev/sdb of=/mnt/sda1/sdb-mbr.dmp bs=512 count=1
ntfsclone --rescue --force --save-image --output /mnt/sda1/sdb1.img /dev/sdb1

The commands above did the task I was looking to accomplish perfectly!

sfdisk dumped the partition table layout (-d option), here I had the classic single-partitioned Windows XP.

dd saved the mbr (the first 512 bytes) into the sdb-mbr.dmp file.

Finally, ntfsclone did an image of my broken partition (don't get confused by sdb1 & sda1 on the last command...).

I used --rescue to have ntfsclone ignore disk errors and --force to have it clone into an image even if the disk was marked as dirty.

The restore procedure.

Once you have your image, you may check if your hdd applies for RMA and restore your image to a new hdd if you have a spare one.

I did shut my Ubuntu workstation down then plugged a new spare raw (ie. unformatted) hdd.

To restore I did:

sfdisk /dev/sdb < /mnt/sda1/sdb-partition-table.dmp
dd if=/mnt/sda1/sdb-mbr.dmp of=/dev/sdb
ntfsclone --restore-image --overwrite /dev/sdb1 /mnt/sda1/sdb1.img

Still can't believe how satisfying it was after chkdsk SUCCESSFULLY checked the new hdd then booted the (once) problematic XP!

Senior Professional Network and Computer Systems Engineer during work hours and father when home.

Andrea strives to deliver outstanding customer service and heaps of love towards his family.

In this Ad-sponsored space, Andrea shares his quest for "ultimate" IT knowledge, meticulously brought to you in an easy to read format.

how to clone and restore an NTFS image of a faulty Windows hdd with ntfsclone and Ubuntu.
Rate this post