How to Backup, Restore and Clone a Windows Partition

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

How to Backup, Restore and Clone a Windows Partition

#1 Post by rcrsn51 »

See the updated Gnost system here.
Last edited by rcrsn51 on Fri 20 Apr 2012, 15:12, edited 4 times in total.

N3ON.SAMURAI
Posts: 9
Joined: Sun 27 Feb 2011, 13:00

Brilliant

#2 Post by N3ON.SAMURAI »

This was shown to me the other day when i was looking for a cloning solution on puppy and just wanted to say thanks. It is a nice piece of work. i have just restored 2 different win7 images to disks at the same time from 2 different image files. worked nicely. both booted happily afterwards without issue.

Fishak
Posts: 12
Joined: Tue 01 Mar 2011, 10:37

#3 Post by Fishak »

Thanks for this tutorial, but I'm having a little trouble.

I created an image file as you outlined, but I was unable to restore it.

First, I formated the original partition with Gparted to a blank NTFS state.

Then, with your downloaded files inside the folder containing the target image file, I selected r (restore) from the rxvt console.

rxvt continues with "NTFS Partition:", and I entered sda2 (the partition I wish to restore to)

"Image Filename:" is displayed, and I entered <the name of my image file>

"Are you sure" = y

Next, the rxvt console asks "Are you transferring the image to a different drive?" Since I'm moving the image from an external drive, back to the original- but reformatted location, I selected y. The restored partition was missing boot files and wouldn't boot.

I again tried- selecting "n" for "... to a different drive?" Still no boot.

I performed a Repair install with the W7 disk, and on reboot the system had to perform a check disk. On the second boot, windows loaded, and all seams fine, but my custome icons (for drives and such) were missing. I tried resetting them by resetting the IconCache.db, but that was unsuccessful. I had to use an image I had created with Macrium Reflect to properly recover.

Your tutorial says "you must prepare the new drive by making an NTFS partition and setting the boot flag."

What do you mean by "setting the boot flag"? Since I don't know what this is, I'm assuming it is at least part of my trouble.

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#4 Post by rcrsn51 »

You were restoring to the SAME drive from which the image was created. If you state that you want to restore to a DIFFERENT drive, gnost will make changes to the MBR. In the case of Win7, that may well make the drive unbootable.

The simpler test would be to make a backup, then immediately do a restore without running Gparted.

Fishak
Posts: 12
Joined: Tue 01 Mar 2011, 10:37

#5 Post by Fishak »

Ok, I will try this again. I have just finished recovering the partition, and aligning all the partitions on the machine. For some reason, after I got the system running again, I found all my partitions were out of alignment. I didn't check them before starting, so it's possible they were already messed up, but I will know for sure this time.

For the second restore attempt above, I formatted, then chose to recover to the same drive, and the bootloader was still inop. My W7 install is all on one partition, because I didn't allow the install to make that 100Mb hidden system volume.

This time I will attempt to restore without formatting the partition, but this isn't a real world test, because if malware had corrupted the drive, or the original drive had failed, I would be placing the image on a freshly formatted partition, or securely erased, and reformatted partition.

Fishak
Posts: 12
Joined: Tue 01 Mar 2011, 10:37

#6 Post by Fishak »

Alright, this time I didn't format the partition. Something still didn't copy right, because I get just a black screen during the Windows start-up section. The normal graphics appear only 1/2 second before the login page comes up- (where users enter their passwords). Everything else looks normal, but it bothers me that something isn't right with the start-up screen.

Alignment was retained on the system partition.

So what do I need to do to copy the image to a formatted partition? Apparently, when you tell it to install back to the same partition, the bootloader isn't touched, but when the bootloader is missing it can't replace it with the original?

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#7 Post by rcrsn51 »

In any Windows PC, the boot process involves two things - the boot code in the Master Boot Record at the root of the drive, and the boot sector at the start of the Windows partition.

Gnost does not back up the MBR, nor touch it if you restore to the same partition. Also, it does not alter the drive's partition structure in any way. It only backs up the content of the NTFS partition. So, in theory, the restored image should work exactly the same as the original. However, Windows is notorious for hiding stuff on a drive that might not be handled by Gnost.

After a restore, Gnost also does some basic disk integrity checks and schedules a Windows disk scan. It may be that your Win7 is reacting to those procedures.

I believe that if you wanted to blank your Win7 partition by reformatting it, Gnost would still restore it correctly, as long as the partition still had its boot flag (you will see it listed in Gparted) and the partition did not move or change size.

However, restoring to a physically different drive or partition is a whole different ball game. The data will be restored, but getting the Windows image to boot in a different location can be difficult. Gnost uses a few tricks that work in XP, but I don't know what happens with Win7.

What I would do is tell Gnost that I am restoring to the SAME location, then use the Windows repair functions to make it bootable.

Do you know for sure that Macrium can restore to a different drive?

N3ON.SAMURAI
Posts: 9
Joined: Sun 27 Feb 2011, 13:00

#8 Post by N3ON.SAMURAI »

To set the boot flag, after setting up your partitions and applying changes in gparted, right click on the partition that will host the windows system, then click on manage flags, and tick the boot box. after that close gparted and then image using gnost.

Fishak
Posts: 12
Joined: Tue 01 Mar 2011, 10:37

#9 Post by Fishak »

Thank you, I am going to try this again, both with the image I made last night, and with a new image, to try and determine if this incorrect restore was a fluke. However, I would like some clarification.
rcrsn51 wrote:Gnost does not back up the MBR...
Is the MBR generic enough that it should be recovered with the W7 Repair install? I use TrueCrypt on one machine, and plan to use it on another to encrypt the system partition. TC makes changes so that it loads before Windows, then it creates a recovery CD, and I'm assuming that CD would replace the MBR. I'm not currently using it on this machine, but does it sound like using TC, and using the TC rescue CD after Gnost recovery, would fix the MBR back to original?
rcrsn51 wrote:Windows is notorious for hiding stuff on a drive that might not be handled by Gnost..
During the install, I forced W7 to stay inside the lines. I only back up and recover that single partition with Reflect, so I know all of Windows is contained within only it.

Yes, Reflect can recover to a different drive. During the restore process it asks if the new partition should be Active, Primary, or Logical. If the new partition is larger than the original, it asks the user how much of the new partition should be used. (the partition can be shrunk to the size of the original partition) The MBR section has radio buttons for "Do not replace", "Replace with the MBR from backup", and "Replace with the standard XP MBR". It also retains alignment if the original partition was aligned when backed up. MR is really a great program, and the only problem I have is that some machines don't have access to USB drives with the recovery CD, I haven't figured out how to mount a TrueCrypt volume and read an image file during recovery.

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#10 Post by rcrsn51 »

You can manually backup an MBR with

Code: Select all

dd if=/dev/sda of=mbr.bin bs=512 count=1
Be VERY careful when using the dd command. Bad things can happen if you make a mistake. However, if you are transferring the image to a new drive, there is no point in restoring an old MBR.

You can manually write a new XP MBR onto a drive with

Code: Select all

ms-sys --mbr --write /dev/sda
Clearly, Gnost is not as sophisticated as Reflect, but it works fine for me with XP when doing backup/restores. I have only attempted cloning to a different drive/partition a few times, but it worked then too.

I have no experience with Win7, so I can't comment.

Could you explain what you mean by "alignment"?

Fishak
Posts: 12
Joined: Tue 01 Mar 2011, 10:37

#11 Post by Fishak »

Gnost is a capable application, and if I simply wish to restore to a previous version of my OS because I'm not happy with the way a program installed itself, it works fine. However, if I need to overwrite a partition with zeroes to expunge malware that has infected the MBR, or if I need to swap out the drive, it doesn't work well for me. When restoring W7 to a zeroed out partition, I must use the W7 install disk to re-write the boot files. When I do this, I loose some my customizations. It's not like it's an unworkable solution, but it's quite a bit more legwork. It's easier for me to overwrite the partition and restore with Reflect than to redo my customizations that get messed up. I also don't know if I could teach this method to my wife, in the event I'm unable to perform a recovery.

I don't have any blank CDs handy here, so I can't test weather the TC rescue disk would restore the original boot files.

In a nutshell, alignment refers to arranging the systems storage LUN so it lines up with the OS file system. Modern disks use 4K sectors, while an OS assumes 512b sectors to allow for comparability with older drives. If the storage device isn't offset to match the file system, than when the OS requests information from one cluster (such as a small random read), the storage device must actually read two clusters to return the data. This is exacerbated on a stripped array, a virtual environment, or an SSD, significantly reducing performance.

shadower_sc
Posts: 136
Joined: Wed 21 Apr 2010, 23:03
Location: Texas

Backup Ext2, Ext3, NTFS

#12 Post by shadower_sc »

Backup Ext2, Ext3, NTFS
I use PING http://ping.windowsdream.com/. It is an awesome free tool.

You can create a Restore Disk that restores your machine to it's original state. Just make sure you don't use that Restore Disk on any other machine, because it will not be useful for making backups. It seems to ignore your I want to back this up request and just restores the Image on the CD/DVD to the Hard Drive. I am sure there are other tools you could use as well, but PING seems to be the simplest for me. Unfortunately it does not support EXT4 at this time.

It probably works fine with FAT32 and DOS as well.

I would love to find a tool that is as simple and powerful as PING that works on Puppy. gnost-tools doesn't seem to fit for me.

DPUP5520
Posts: 800
Joined: Wed 16 Feb 2011, 05:38

#13 Post by DPUP5520 »

@shadower_sc
Partimage is in the PPM so you could effectively use that in Puppy without needing to go and burn PING (Partimage is Not Ghost) to a whole different CD. I've been using this and GParted together on Puppy for a while now and haven't had any problems at all.

shadower_sc
Posts: 136
Joined: Wed 21 Apr 2010, 23:03
Location: Texas

Partimage in the PPM? Awesome! :-)

#14 Post by shadower_sc »

Cool. :-) I'll have to give that a try. :-)

Antipodal
Posts: 253
Joined: Thu 26 Mar 2009, 16:52
Location: The other side of the world

Re: How to Backup, Restore and Clone a Windows Partition

#15 Post by Antipodal »

On the first post of this thread
rcrsn51 wrote:For the home user who just wants to back up Windows to an external USB drive, all the necessary tools are available through Puppy.
Do you think this statement includes Puppy 4.1.1 on a live CD?
Posting from a P4 3Ghz_ASUS P5G41T-M LX3_2G RAM_DVD Write desktop with no internal HDD
Saving my stuff on flash sticks and in external USB HDD

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

Re: How to Backup, Restore and Clone a Windows Partition

#16 Post by rcrsn51 »

Antipodal wrote:On the first post of this thread
rcrsn51 wrote:For the home user who just wants to back up Windows to an external USB drive, all the necessary tools are available through Puppy.
Do you think this statement includes Puppy 4.1.1 on a live CD?
The key tool is ntfsclone. Type the command

Code: Select all

which ntfsclone
If Puppy 411 contains this program, you are good to go.

Antipodal
Posts: 253
Joined: Thu 26 Mar 2009, 16:52
Location: The other side of the world

How to Backup, Restore and Clone a Windows Partition

#17 Post by Antipodal »

Thank you :D
Posting from a P4 3Ghz_ASUS P5G41T-M LX3_2G RAM_DVD Write desktop with no internal HDD
Saving my stuff on flash sticks and in external USB HDD

Post Reply