LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Recovery with Knoppix! (https://www.linuxquestions.org/questions/linux-general-1/recovery-with-knoppix-404545/)

grim2 01-17-2006 01:36 PM

Recovery with Knoppix!
 
Hi!

I try to create recovery procedure for my server on which is installed Red Hat Enterprise Server 3. I use Knoppix 4.0.2 and tar command.
My procedure is:

1) backup
- create full backup with tar command:

tar .... /d1/full_backup.tar.gz / --exclude=proc --exclude=full_backup.tar.gz . (I haven' type flags but they are OK.)

- copy backup file to other location using ssh

- save my partitions information and mount points (I haven't post mount points.)

[root@testbackup root]# fdisk -l

Disk /dev/hda: 80.0 GB, 80000000000 bytes
255 heads, 63 sectors/track, 9726 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 33 265041 83 Linux
/dev/hda2 34 1945 15358140 83 Linux
/dev/hda3 1946 3857 15358140 83 Linux
/dev/hda4 3858 9726 47142742+ f Win95 Ext'd (LBA)
/dev/hda5 3858 5769 15358108+ 83 Linux
/dev/hda6 5770 7426 13309821 83 Linux
/dev/hda7 7427 8446 8193118+ 83 Linux
/dev/hda8 8447 8828 3068383+ 83 Linux
/dev/hda9 8829 9210 3068383+ 83 Linux
/dev/hda10 9211 9592 3068383+ 83 Linux
/dev/hda11 9593 9723 1052226 82 Linux swap

2) recovery
Here I have problems. My idea is:
- boot computer with Knoppix
- create partitions using QtParted (even better using fdisk)
- mount partitions (first I mount / partition (/dev/hda7) to directory /start and than create other mount points in directory /start and mount other partitios to those mount points)
- copy backup file using ssh to partition /d1 (/dev/hda3)
- unzip archive with:

tar ..... /d1/full_backup.tar.gz --directory=/start

This is strange: if I just format same partitions after booting with Knoppix (without deleting partitions table) recovery works great and everything is OK. But if I first delete partitions table using fdisk or QParted and then create partitions using QtParted (real case scenario when destroyed disk is replaced with the new one with same geometry) after I reboot computer I get just "GRUB" in upper left conner of screen.
Even more strange is when I use fdisk. I use same values for partitions "start" and "end" cylinders from above parition table and I get same partitions table as above except of culumn "Blocks". And when I check these partitions are much smoller then original under Red Hat (for example /dev/hda1 (/boot) was 256MB and now is 16MB). How is this possible? Because of this there isn't enough space for unziping backup file.
So I use fdisk with partitions size (+256M) insteed of start and end cylinder. But in this case result is same as with QtParted ("GRUB").

So, how can block size be differnt under Red Hat and Knoppix if start and end cylinders are the same?

Why recovery works if I don't delete partitions table and use same (formated) partition which are creted using Red Hat and doesn't work when I recreate partitions table and partitions?

Can anybody help me with this?

Thanks!

halvy 01-17-2006 03:38 PM

partitianing is a black art ;)

i can't answer your 'why' questions, other than you should use cdisk (better than qt & fdsk) because it is more powerful.

cfdisk also will let you know when you REALLY have a problem, where the guis sometimes give false negatives.

it sounds like you need to start from scratch.. because sometimes partitian tables get SOOO messed up (ie cross links, corruption, false reporting), there is really no benefit in trying to restore them.

good luck.

grim2 01-19-2006 08:47 AM

OK. I solved the problem with disk geometry using as starting point when recreating partition table command:

# fdisk -C 9726 -H 255 -S 63 /dev/hda

After that I create and mount partitions. Now I have exactly the same partition table as it was on original system (output of the command #fdisk -l is the same).
Rest of my procedure is the same. I copy backup file to the disk and unzip it with:

#tar -zxvpf /start/d1/full_backup.tar.gz --directory=/start

But still no lack. After rebooting computer I get black screen with blinking cursor. I even tried to restore partition table (MBR) from original system (created with command: # dd if=/dev/hda of=backup-mbr count=1 bs=512) with command:

# dd if=backup-mbr of=/dev/hda

But, after reboot I get "GRUB" in upper left conner. So, I think that there is something wrong with MBR. I tried to reinstall GRUB, but no lack.

Any ideas?

Thanks!

bobmclaren 01-19-2006 09:06 AM

I seem to remember there being a concept of marking a partition as the "active" partition. This instructs the boot process to look there for the boot loader. You should be able to do this with fdisk. (I've never used cfdisk, but thanks for the tip halvy, I'll give it a shot)

grim2 01-20-2006 05:40 AM

I have set partition as active with fdsik (there is an asterix *) in the line for boot partition. But result is the same. I have two cases:

1)When I recreate partition manually with fdisk and restore backup after rebooting I get only blinking cursor in upper left conner of the screen.

2)When I restore partition table (using old partition table) with:

# dd if=backup-mbr of=/dev/hda

,restore backup and reboot I get word "GRUB" in upper left conner of the screen.

Any other ideas?

Thanks!

bobmclaren 01-20-2006 08:49 AM

Perhaps repair grub with grub-install?
boot w/knoppix, mount /dev/hda1 to /mnt/hda1 then run the following command,
Quote:

sudo chroot /mnt/hda1 grub-install /dev/hda
Another question is, when you backed up your MBR, how many bytes did you grab? A lot of people grab 512 bytes, but that is actually the MBR + partition table, if you only want the MBR, you need to grab 446 bytes. I would think that since you are restoring the same partition table, that this mistake wouldn't hurt you, but I won't pretend to understand how all this works entirely, so I can't be sure.

grim2 01-23-2006 05:18 AM

I try to reinstall GRUB.

# mount -t ext3 /dev/hda1 /start (mount /boot partition)

And then from within GRUB:

grub> find /boot/grub/stage1
(hd0,0)
grub> setup (hd0,0)
....
...
...
... succeeded
Done.

grub> reboot

After this restart I again come to GRUB. I don't know what is wrong?

bobmclaren 01-23-2006 10:07 AM

I'm not familiar with the setup (hd0,0) command. Is that the same as grub-install?
If so, I'm running out of ideas.
Check the menu.1st file, to ensure it's pointing at the correct location.
Also, I checked my knoppix reference guide and there is an additional option to grub-install that might help you.
Quote:

sudo chroot /mnt/hda1 grub-install --root-directory=/mnt/hda1 /dev/hda

grim2 01-24-2006 08:34 AM

Looks like it finaly worked... I don't know what was wrong earlier.

First, I've formated partitions one by one with:

# make.ext3 /dev.hda1 -L /boot
.
.
.

After that I've destroyed partition table with:

# dd if=/dev/zero of=/dev/hda count=1 bs=512

That all should simulate that old disk has been destroyed and replaced with new one.

--Restore

1) restore MBR and partition table

# dd if=/dev/hda if=/mnt/auto/floppy/backup-of-hda-mbr (I've backed up 512 bytes.)

2) format partitions with:

# make.ext3 /dev.hda1 -L /boot
.
.
.

3) mount partitions:

# cd /
# mkdir start
# mount -t ext3 -o rw /dev/hda7 /start (/ partition)
# mkdir /start/boot
# mkdir /start/d1
.
.
# mount -t ext3 -o rw /dev/hda1 /start/boot
.
.

4) copy backup (using ssh) from network computer to /start/d1

5) restore backup:

# tar -zxvpf /start/d1/full.tar.gz --directory /start

Everything looks OK. I will try to format disk with Windows installation CD and try all procedure tomorow.

I was so close to give it up on this.

Thank for all your help!

halvy 01-24-2006 01:18 PM

just remember that doze will erase (format) whatever partitian you put it on.

it may even destroy 'all' of the partitions (ie logical) ones, depending on how you have things 'set up'.

and the mbr is definitely in jeopardy.


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