Pre-installation, harddisk imaging/backup for dual boot

I am new to linux and I am getting started in openSuse 11.0. I have Windows XP currently installed on my laptop’s harddrive (30 gig). Since I want to dual boot, I have to make an exact replica of the windows bootable. How would I achieve this (note that the image have to contain the boot stuff)?
I have tried using “dd” but found out I cannot use it in my scenario, because I dd the whole 30 gig drive which is ntfs. But I could not restore it because I would have to shrink my ntfs partition to 20 gig (the other 10 gig for Suse).
About 15 out of the gig is used on the harddrive. I have found several damaged blocks. The image I will be writing to is another external harddrive connected via USB (hopefully I wont wipe this drive out from making the image).
Any ideas? This is urgent! Thanks in advance =]

Have a look at partimage: Main Page - Partimage
But I don’t quite understand what you want, is it this: to tuck away a faithful copy of the 30Gb ntfs partition in a smaller space than 30Gb, on a backup usb drive, including partition information and Master Boot Record information, so that: in case everything falls to straw and you can put it back just as it was.
Is that it? If not that, be more specific so we can give less vague advice than “have a look at partimage” :wink:

PS – just noticed you new member – WELCOME HERE!:slight_smile:

yes exactly. after i install suse, i will leave only 20 gig for windows ntfs. so i want a good copy with partition info, MBR info, etc no larger than 20 gig so i cant restore it after i install suse. note that only 15 gig is used, so this is possible.

I’ve looked into partimage, until i saw its support for ntfs is experimental. there are some compressed data on the drive, so i am afraid to use partimage. I’ve also looked into clonezilla. it seems to use ntfsclone, which doesnt copy the MBR stuff.

Thanks for the reply and for the welcome ^^ (i just got here on today’s afternoon)

Hardly need saying that you should tidy up the windows files, reduce them, and defrag the drive first.
You can store the partition information by booting into a linux disk like System Rescue CD, attach like the usb drive, mount it and copy the partition for windows drive info to a file on the usb drive. You can also copy the Master Boot Record to a file on it too. Then I would use partimage because the warning about “mature” is IMHO legal politics. But use clonezilla if you like – good as any.

Here’s a bit more on backing up the MBR and the partition information here:
Backup Restore Images of Hard Disk Drive Partitions
Particularly segments titled:
Backup/Restore Master Boot Record
Backup/Restore Partition Table

alright. it seems like i have to clone the MBR and the data separately. by the way, to make an exact windows bootable drive i have right now, it is essential to copy the MBR and the partition table, right? what about partition sizes and filesystems?

do you know which program supports windows compressed files? all my files were compressed and i had them uncompress. but error occured on some so several files still remain compressed.

i would have to restore these images after i installed suse. so what would be the order of restoration (MBR, partition table, data)? i wouldnt want to loose any data, concerning MBR takes place at the first block. if i restore data, wouldnt it be wiped out? sorry i tend to over-think (paranoid? lol) this is my first time doing this.

Thank you so much for the tutorial website. It’s very detailed and helpful.

If you want to make exact copy, just use dd to copy the whole drive, MBR (which includes a partition table) and all. Just have the second drive equal to or greater than the first oin size. Like this command:

dd if=/dev/sda of=/dev/sdb

Then when things fall apart, do it in reverse to restore.
Or if you want to zip and store the whole drive, say on sdb1, mount sdb1 somewhere like /pathto/mount and zip it:

dd if=/dev/sda | gzip > /pathto/mount/backup.img.gz

then in event of disaster do this:

dd if=/pathto/mount/backup.img.gz of=/dev/sda

Simpler still to swap sda and a brand new larger sdb, use dd to clone the old windows across to the new drive, then install Suse on the vast extra space on the new drive. This might be particularly attractive since you said you had bad blocks on the old drive so it will collapse sooner or later.

well things get complicated when:

A) the external drive is SATA, incompatible with laptops internal drive interface: IDE.
B) if i just use dd (which i did), it copies the whole drive with the bad and unused blocks, which totals up to 30 gig. but after i install suse i will leave only 20 gig for it.
C) i cant find any program that supports windows compressed files (not .zip/etc but files compressed by the windows filesystem)

so by backing up separetely, there are two things to backup: the data/system files and the MBR (which includes the partition table), right? what would be the order of restoration?

i would have to restore these images after i installed suse. so what would be the order of restoration (MBR, partition table, data)? i wouldnt want to loose any data, concerning MBR takes place at the first block. if i restore data, wouldnt it be wiped out?

Your problem is that you want to preserve a 30Gb source in a form that restores to 30 Gb for later restoration to a 20 Gb space. It’s conceptually impossible (as you pointed out). The only thing I can think of is to shrink the 30 Gb drive to 20Gb. That might or might not involve transferring data off of the laptop drive to make more space there, and then shrinking the NTFS drive to, say, 20 Gb, then making a backup image of that. Will that do?

I must say this: if you have bad blocks on the laptop’s hard drive, it’s likely the entire problem will soon vanish, very likely very soon, because drives with bad blocks are usually in a state of progressive collapse. IMHO your most urgent task is to back up your data while you can; and if you must do that and replace the lappy’s hard drive, well now a days I don’t think you can get less that about 60/80Gb for the drive, so the problem is solved perhaps?

just to make life much more easier, i will be using the 30 gig drive. so i need to copy the MBR and data = 2 things.

to copy the MBR, use the command below:

dd if=/dev/hda of=/mnt/sda1/backup-hda.mbr count=1 bs=512

and to copy data, can i just copy and paste the files (instead of having them go images)?

and to copy data, can i just copy and paste the files (instead of having them go images)?

i meant the windows system files.

It’s usually not going to work copying a windows install from one drive to another as files and then back again as files at some later date. It seems to require a deeper level, like imaging.

okay. right now, i have no idea what i should do. i cant use dd because this is a 30 gig drive with 15 gig used space (windows). and after i install linux, i will only leave 20 gig for windows. this makes it impossible to restore. so i need to make an image of the used blocks, only. and i have no idea how to do that.

You can compress the drive to less than 30Gb by focus on used blocks only – but you can’t restore that to a partition less than 30Gb. That’s like the third law of thermodynamics.
Your options are to shrink the windows drive to 20Gb or less and then image it OR to get a larger drive or additional drive and redesign the endeavor.

i had no luck shrinking the drive with qtparted and partitioner.
i had no luck restoring the image to a larger drive. when i boot that drive up it says read error.
i also tried nero backup. it did not work (might be read error also).
i tried just restoring the MBR. it did not work.

Suggest you turn off the compression. Then defrag the drive. Then backup the data – definite must to back up the data because you could lose the ntfs partition. Then clear the space after it by deleting any Linux partitions you might have made there (if any). Then shrink ntfs drive with gparted on a bootable CD downloadable from the gparted site. You can see how much filled and empty space the ntfs partition has, on the gparted screen. It will shrink. If it doesn’t, you’ve made a mistake. Then install Suse in the spare space at the end of the smaller ntfs partition.

i defraged my drive more than a dozen times. still it doesnt seem to defrag any further. so i ran ntfsclone and it reported the following error msg:

bt WindowsXP # ntfsclone --save-image --output /mnt/sda1/WindowsXP/ntfsclone_xp.img /dev/hda1
ntfsclone v2.0.0 (libntfs 10:0:0)
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 29998047232 bytes (29999 MB)
Current device size: 29998047744 bytes (29999 MB)
Scanning volume …
100.00 percent completed
Accounting clusters …
Cluster accounting failed at 337766 (0x52766): extra cluster in $Bitmap
Cluster accounting failed at 337767 (0x52767): extra cluster in $Bitmap
Cluster accounting failed at 337768 (0x52768): extra cluster in $Bitmap
Cluster accounting failed at 337769 (0x52769): extra cluster in $Bitmap
Cluster accounting failed at 337770 (0x5276a): extra cluster in $Bitmap
Cluster accounting failed at 337771 (0x5276b): extra cluster in $Bitmap
Cluster accounting failed at 337772 (0x5276c): extra cluster in $Bitmap
Cluster accounting failed at 337874 (0x527d2): extra cluster in $Bitmap
Cluster accounting failed at 337875 (0x527d3): extra cluster in $Bitmap
Cluster accounting failed at 337876 (0x527d4): extra cluster in $Bitmap
Totally 20 cluster accounting mismatches.
ERROR: Filesystem check failed! Windows wasn’t shutdown properly or inconsistent
filesystem. Please run chkdsk /f on Windows then reboot it TWICE.

its true that my Windows wasnt shutdown properly because of power failure (many times). and i couldnt run chkdsk /f.

You can run “chkdsk /f” by booting into windows → Start → run → cmd → chkdsk /f. Or you might need to specify the drive if there is more than one (e.g. chkdsk e: /f). You should be asked “Wopuld you like to rescg=hedule … next time the system restarts?” → answer y

Then reboot so the check can occur.

Watch the screen closely for error messages during the running of the check after the reboot. It might talk about bad sectors – report those here.

it doesnt seem to work =(

I don’t understand.
Do you mean you can’t boot into windows to run chkdsk?