Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Hardware
User Name
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?


  Search this Thread
Old 08-09-2006, 08:22 AM   #1
LQ Newbie
Registered: Jan 2006
Location: Sydney
Distribution: ubuntu
Posts: 4

Rep: Reputation: 0
XP Backup/Restore from Linux failed - Help please!!!

In summary:

hda is 40GB disc
hda1 = 10GB XP NTFS
hda2 = 1GB spare FAT32
hda3 = 1GB spare FAT32
hda4 = extended partition
hda5 = 5GB ext3 /root
hda6 = 500MB swap
hda7 = 10GB ext3 /home

hdb is 4GB disc
hdb1 = 4GB ext3

Linux is ubuntu and I'm on ubuntu live DVD now.

used dd to copy boot sector to file on hdb1
used ntfsclone to copy hda1 image to hdb1

used dd to wipe boot sector on hda
used dd to rewrite boot sector on hda
used ntfsclone to restore hda1

system starts, goes through POST

grub does not appear to start (?)

invalid boot.ini file
booting from c:\windows\

reboots goes thorugh POST etc, etc.

live DVD will not allow me to mount hdb... not sure why.

Partition tool of ubuntu install shows hda to be blank.

Any ideas on how to restore my system?

I could rebuild it in a couple of days but would like a smarter solution.

ANY suggestions would be appreciated.

Old 08-09-2006, 10:50 AM   #2
Registered: Apr 2005
Distribution: Debian
Posts: 154

Rep: Reputation: 30
Im not sure how helpful this is, but it seems that Windows overwrote the MBR (Invalid boot.ini file... .ini is a Windows file extension).

About the size of the disk appearing to be blank, I think its because of the tool and not the disk. At a terminal, type:
ls /dev | grep hda

Hopefully you will see hda1, hda2, etc. Not that this will help anything, but it should at least remind you that your data is intact.
Old 08-10-2006, 01:29 AM   #3
Registered: Aug 2006
Distribution: MEPIS
Posts: 73

Rep: Reputation: 15
I'm a newbie and don't know much (if anything), but I do recall reading about setting up boot.ini for a multiple boot system. If you want to run Linux in multi-boot, the advice was to keep W OS on the first drive or partition, and to boot to Linux from there. It was easy, too.

Specific lines to put into the boot.ini were included in that post (I believe it was on Of course, you cannot get W OS to recognize the Linux partitions, nor will it obligingly update boot.ini for you, but it's apparently very easy for you to edit boot.ini to fix the problem. If you can't find the post to which I refer with a search for something like 'dual boot,' holler back here and I'll see if I can find it. I'm fairly sure I saw this information more than once (in more than one post), so I expect it's correct.
Old 08-10-2006, 03:45 AM   #4
LQ Guru
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
By doing 'dd if=/dev/zero of=/dev/hda bs=512 count=1' will erase the boot sector. Before using dd, I recommend using sfdisk to make a backup of the partition table on /dev/hdb and /dev/hda. Then save the output to one of the hda partitions or just save to a floppy or any removable mediums. If I not mistaken nftsclone can only do the same capacity. Since hdb1 is not the same, you are screwd. I think you actually hosed both hard drives when using dd. In order to get the data back, you need to send it to a data recovery service and have them detect the old magnetic field before zeroing the entire drive.

I suggest using Norton Ghost. It makes it a lot easier to clone a disk or a partition. I do not think Ghost for Linux can do it. Next time be careful using dd while including /dev/zero device and double check the syntax before hitting enter. I recommend plan what you are going to do. Planning always takes less time than fixing a mess.

Use the Live CD at

Good luck if you do not have any backups.
Old 08-10-2006, 08:21 AM   #5
LQ Newbie
Registered: Jan 2006
Location: Sydney
Distribution: ubuntu
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks guys!

Thanks for all the suggestions guys.

All is well again.

Used testdisk from UBCD4WIN to scan /dev/hda and identify my partitions, rewrote the MBR so Windows would boot.

Then used ubuntu Live DVD and reinstated grub.

The problem was a very simple one, my script copied the "MBR" from /dev/hda1 instead of /dev/hda and then wrote the bogus MBR to /dev/hda...

My scripts have been fixed and tested again and my virgin XP with all my apps is secure.


Old 08-10-2006, 08:33 AM   #6
LQ Newbie
Registered: Jan 2006
Location: Sydney
Distribution: ubuntu
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks Electro.

ntfsclone piped to gzip allowed me to take 3GB of used space from my 10GB partition and compress it down to 1.8GB

I recently ruined my partition table using diskdrake with an old kernel and had to send my machine to a recovery service, they couldn't get anything back after 3 days so I took it back, paid $70 for a package called iRecover which returned 3,300 out of 3,500 files.

My plan was good, the execution was poor.

I now have less fear and more knowledge!


Old 08-10-2006, 09:08 AM   #7
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 16,728

Rep: Reputation: 2467Reputation: 2467Reputation: 2467Reputation: 2467Reputation: 2467Reputation: 2467Reputation: 2467Reputation: 2467Reputation: 2467Reputation: 2467Reputation: 2467
Congratualtions - bugger all people test their backup regimes.
Better to find out now.

I have never been convinced of the efficacy of backing up the MBR.
sfdisk maybe, dd forget it.

For an "instant" backup-restore it works o.k, else basically useless.
But at least you now know how to work around a failure.


backup, dd, mbr, ntfsclone, partition, restore

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to backup & restore the MBR in linux? sgzlit Linux - Newbie 7 03-02-2005 09:07 PM
Need to backup then restore a linux partition stuart Linux - General 5 07-16-2004 07:30 AM
Linux Raid system backup and restore ron4linux Red Hat 1 08-29-2003 12:57 PM
How to backup and restore a working Linux System redwolf Linux - General 3 07-27-2003 08:01 PM
dump + restore to backup linux ; "Couldn't find matching filesystem: LABEL=/" on boot markus1982 Linux - General 4 09-21-2002 01:16 PM > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 11:27 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration