LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   partimage backup failing (https://www.linuxquestions.org/questions/linux-newbie-8/partimage-backup-failing-626027/)

babag 03-05-2008 09:10 PM

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

bigrigdriver 03-05-2008 09:31 PM

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).

babag 03-05-2008 09:43 PM

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

homey 03-05-2008 09:51 PM

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


.

Emerson 03-05-2008 09:54 PM

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.

homey 03-05-2008 10:03 PM

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

jschiwal 03-05-2008 10:05 PM

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.

homey 03-05-2008 10:11 PM

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)

bigrigdriver 03-05-2008 10:15 PM

Yup. My bad. I mis-read the original post. My apologies to everyone.

babag 03-05-2008 10:26 PM

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

jschiwal 03-06-2008 02:43 AM

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.

homey 03-06-2008 04:54 AM

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.

babag 03-06-2008 12:02 PM

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.

Emerson 03-06-2008 12:14 PM

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).

babag 03-06-2008 12:25 PM

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


All times are GMT -5. The time now is 09:50 PM.