LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-05-2008, 10:10 PM   #1
babag
Member
 
Registered: Aug 2003
Posts: 367

Rep: Reputation: 30
partimage backup failing


i backed up my main partition (mandriva) with partimage
and it's failing to restore. i just get the word 'GRUB'
flashing in endless columns across the screen.

i may get hda and sda mixed up in the following explanation
but that was not the case in the backup/restore process.
systemrescuecd called my primary disk sda and my notes
usually refer to hda. that's why.

what i did:

i used the gui for partimage to make a backup. that was
pretty straightforward, i thought.

i backed up my mbr with:

dd if=/dev/hda of=/home/where/i/put/it/hdaboot.mbr bs=512 count=1

i made note of the partition tables as listed from fdisk.

i then rebuilt the partition tables on the new drive
to match the old.

i used dd if=/home/where/i/put/it/hdaboot.mbr of=/dev/sda to
restore the mbr

i used:
partimage restore /dev/sda1 /home/where/i/put/it/image.000

to restore the image to hda1 (systemrescuecd called it sda1).

i did make the hda1 partition bootable when i used fdisk
to reconstitute the partitions.

when i reboot i get the grub loader just endlessly displaying
the word 'GRUB' in columns and the system never boots.

what did i do wrong?

thanks,
BabaG
 
Old 03-05-2008, 10:31 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Jessie 8.4
Posts: 5,873

Rep: Reputation: 348Reputation: 348Reputation: 348Reputation: 348
Quote:
i backed up my mbr with:

dd if=/dev/hda of=/home/where/i/put/it/hdaboot.mbr bs=512 count=1
Quote:
i used:
partimage restore /dev/sda1 /home/where/i/put/it/image.000

to restore the image to hda1 (systemrescuecd called it sda1).
Sounds like you backed up the MBR, but restored it to the boot sector of the partition instead of the MBR.

Maybe the restore should have gone like this:
Code:
partimage restore /dev/sda /home/where/i/put/it/image.000
to restore the image to sda (the MBR) instead of sda1.

Beyond that, it might be helpful to see the output of fdisk -l for the old and new disks, as well as the contents of /boot/grub/menu.lst (to compare menu stanzas with partition numbers as reported by fdisk).

Last edited by bigrigdriver; 03-05-2008 at 10:35 PM.
 
Old 03-05-2008, 10:43 PM   #3
babag
Member
 
Registered: Aug 2003
Posts: 367

Original Poster
Rep: Reputation: 30
my mbr backup is named hdaboot.mbr

i used:

dd if=hdaboot.mbr of=/dev/sda

to restore the mbr



and:

partimage restore /dev/sda1 /home/where/i/put/it/image.000

to restore the image to hda1




i was under the impression that the dd and sda (without the
numeral 1) would address the mbr and that the partimage command
WITH the numeral 1 would put my image back to the parttition.

is that not right?

thanks for the prompt reply,
BabaG
 
Old 03-05-2008, 10:51 PM   #4
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 59
Sorry bigrigdriver but, you got that abit wrong. Partimage restores the os data to a partition.
Use dd to restore the mbr...
this part is correct
Code:
backed up my mbr with:
dd if=/dev/hda of=/home/where/i/put/it/hdaboot.mbr bs=512 count=1
To restore the mbr, I use bs and count here also but you could go one step more and erase the old boot sector first...
Code:
dd if=/dev/zero of=/dev/sda bs=512 count=1
Code:
dd if=/home/where/i/put/it/hdaboot.mbr of=/dev/sda bs=512 count=1
Before using partimage, I like to format the partition...
mkfs.ext3 /dev/sda1
Then, partimage
Code:
partimage restore /dev/sda1 /home/where/i/put/it/image.000


.
 
Old 03-05-2008, 10:54 PM   #5
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 5,872

Rep: Reputation: Disabled
Quote:
dd if=/dev/hda of=/home/where/i/put/it/hdaboot.mbr bs=512 count=1

i made note of the partition tables as listed from fdisk.

i then rebuilt the partition tables on the new drive
to match the old.

i used dd if=/home/where/i/put/it/hdaboot.mbr of=/dev/sda to
restore the mbr
bs=512 backs up not only MBR but partition table too, restoring from it you overwrote your new partition table.
 
Old 03-05-2008, 11:03 PM   #6
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 59
Another thing you could do is to use sfdisk to dump the mbr/partition table to a file which is readable...
Code:
sfdisk -d /dev/sda > mbr.out
then, you restore it with
Code:
sfdisk /dev/sda < mbr.out
 
Old 03-05-2008, 11:05 PM   #7
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Use the "file" command to examine the filesytems:
sudo file -s /dev/sda

See if you can mount your root partition and if it is separate, the boot partition. Are you using a new kernel or the same kernel but a SATA drive?
If so, a device or file or the root entry listed as /dev/hdaX before may need to be listed as /dev/sdaX in the new one. Also make sure that the device order hasn't changed.

Look at the partimage backed up file. Is it an actual image, such as dd would create? "file -s image.000". I haven't used partimage before. dd ... | gzip works fine for me. But I would use tar for backups instead of an image backup. What happens if the image becomes damaged or the disk has a bad sector? (Actually, I prefer using dar/kdar to back up dvd sized slices)

Also look at your saved MBR. "file hdaboot.mbr". If you manually partitioned the new drive identically, you could restore only the first 244 bytes to prevent writing over the partition table.
dd if=hdaboot.mbr of=/dev/sda bs=244 count=1

If the partimage backup of /dev/hda1 is an image of the filesystem, you could at least mount the backup image (using loopback device) and copy files from it.
 
Old 03-05-2008, 11:11 PM   #8
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 59
One last thought before I hit the hay.
Quote:
when i reboot i get the grub loader just endlessly displaying
the word 'GRUB' in columns and the system never boots.
You may just need to run the grub command and tell it to use
root (hd0,0)
setup (hd0)
 
Old 03-05-2008, 11:15 PM   #9
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Jessie 8.4
Posts: 5,873

Rep: Reputation: 348Reputation: 348Reputation: 348Reputation: 348
Yup. My bad. I mis-read the original post. My apologies to everyone.
 
Old 03-05-2008, 11:26 PM   #10
babag
Member
 
Registered: Aug 2003
Posts: 367

Original Poster
Rep: Reputation: 30
thanks homey. just tried it again with the bs and count on the
mbr restore. same thing: GRUB flashing in columns. i'm wondering
if there's maybe something wrong with the image. will try again
tomorrow with a new image.

one question, though. the drive i'm restoring to is of a different
size than the original. for that reason i'm being careful to
partition the partition in question to match the original. the
rest of the drive, however, is different:

Device Boot Start End Blocks Id System
/dev/hda1 * 1 454 3646723+ 83 Linux
/dev/hda2 455 2491 16362202+ 5 Extended
/dev/hda5 455 802 2795278+ 82 Linux swap / Solaris
/dev/hda6 803 2491 13566861 83 Linux

above is the fdisk table of the original drive. i've been
careful to keep hda1-5 matching this. hda6, however, which i
use as /home is sometimes different. it always has started at
the same block, 803, but the end is different depending on
what drive i'm trying to get this to work on. i was working
under the assumption that since i'm specifically restoring
hda1, it wouldn't much matter if hda6 was something different.

is that correct?

thanks again,
BabaG
 
Old 03-06-2008, 03:43 AM   #11
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Yes, as far as /dev/hda1 is concerned. If you restore the mbr backup that you have, you will be writing over the partitioning that you created manually with fdisk.

Can you boot up with a rescue disk and enter its grub shell. From there see if you can find the kernel and initrd files. If so, enter the "kernel .." and "initrd " lines in the shell (use tab completion to make typing easier) and then enter the boot command. If it can boot up, then see if any values in /etc/boot/menu.lst need fixing, such as /dev/hda1 -> /dev/sda1. Then use the grub-install program to try to fix things.

Last edited by jschiwal; 03-06-2008 at 03:47 AM.
 
Old 03-06-2008, 05:54 AM   #12
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 59
If you want to hurry up and get something working on the new drive before the old one fails, I would use the clonezilla livecd to copy disk to disk.
Then worry about resizing the partitions after it's up and working.
The parted magic livecd is good for that part.
 
Old 03-06-2008, 01:02 PM   #13
babag
Member
 
Registered: Aug 2003
Posts: 367

Original Poster
Rep: Reputation: 30
i have systemrescuecd. does that have the grub shell? how would i
do this? would i use that shell like bash or something to navigate
to my sda1 and find the kernel and initrd files? never been anywhere
near this deep into things so for give the dumb questions please.
mandriva seems to have a /initrd directory but the only thing in it
is a README.WARNING file. the file just says not to remove the
directpry as its needed for booting.

homey: i don't follow the clonezilla thing. i'd need a much more
step by step description to be able to pull that one off. will look
around for a guide but when i've looked at clonezilla before the
info i found all had a lot of chinese or such text attached and i
shyed away from it.
 
Old 03-06-2008, 01:14 PM   #14
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 5,872

Rep: Reputation: Disabled
OK, hope I will not confuse you, but here's what I'd recommend.
Create a partition on your new HDD, at least as big as it was on old one, or bigger. Restore it from partimage image. Boot up with LiveCD, chroot into your Linux installation, install GRUB. Probably there is a script to do this (grub-install in Gentoo).
 
Old 03-06-2008, 01:25 PM   #15
babag
Member
 
Registered: Aug 2003
Posts: 367

Original Poster
Rep: Reputation: 30
thanks emerson. could you provide details or links on
'chroot into your linux installation'?

once there, how do i install grub? is it in the installation
or do i have to get it from someplace? this is a standalone
box.

thanks,
BabaG
 
  


Reply


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
Partimage Backup FredGSanford Linux - Software 3 01-02-2008 01:08 AM
Using partimage to backup HD? JockVSJock Linux - Software 1 02-26-2006 06:52 PM
Speed up partimage backup Swift&Smart Slackware 12 11-11-2005 08:32 AM
Partimage backup questions jrdioko Linux - Newbie 11 09-24-2004 05:22 PM
Using partimage with network backup Swift&Smart Linux - Software 2 06-20-2003 12:42 AM


All times are GMT -5. The time now is 02:18 PM.

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