LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-17-2006, 01:36 PM   #1
grim2
LQ Newbie
 
Registered: Jan 2004
Posts: 18

Rep: Reputation: 0
Angry 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!
 
Old 01-17-2006, 03:38 PM   #2
halvy
Member
 
Registered: Aug 2005
Location: Anchorage, Alaska (soon EU, hopefully)
Distribution: Anything NOT SystemD (ie. M$) related.
Posts: 918

Rep: Reputation: 42
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.

Last edited by halvy; 01-23-2006 at 11:40 AM.
 
Old 01-19-2006, 08:47 AM   #3
grim2
LQ Newbie
 
Registered: Jan 2004
Posts: 18

Original Poster
Rep: Reputation: 0
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!
 
Old 01-19-2006, 09:06 AM   #4
bobmclaren
LQ Newbie
 
Registered: Nov 2005
Location: Senoia, GA
Distribution: Latest Fedora
Posts: 14

Rep: Reputation: 0
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)
 
Old 01-20-2006, 05:40 AM   #5
grim2
LQ Newbie
 
Registered: Jan 2004
Posts: 18

Original Poster
Rep: Reputation: 0
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!
 
Old 01-20-2006, 08:49 AM   #6
bobmclaren
LQ Newbie
 
Registered: Nov 2005
Location: Senoia, GA
Distribution: Latest Fedora
Posts: 14

Rep: Reputation: 0
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.
 
Old 01-23-2006, 05:18 AM   #7
grim2
LQ Newbie
 
Registered: Jan 2004
Posts: 18

Original Poster
Rep: Reputation: 0
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?
 
Old 01-23-2006, 10:07 AM   #8
bobmclaren
LQ Newbie
 
Registered: Nov 2005
Location: Senoia, GA
Distribution: Latest Fedora
Posts: 14

Rep: Reputation: 0
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
 
Old 01-24-2006, 08:34 AM   #9
grim2
LQ Newbie
 
Registered: Jan 2004
Posts: 18

Original Poster
Rep: Reputation: 0
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!
 
Old 01-24-2006, 01:18 PM   #10
halvy
Member
 
Registered: Aug 2005
Location: Anchorage, Alaska (soon EU, hopefully)
Distribution: Anything NOT SystemD (ie. M$) related.
Posts: 918

Rep: Reputation: 42
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.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Cheat Knoppix 4 -- Part 2. Knoppix Performance Improvement Cheats LXer Syndicated Linux News 0 01-12-2006 04:46 PM
knoppix & datarescuepc (data recovery software) carter_2k5 Linux - Distributions 0 11-13-2005 08:59 AM
fat32 data recovery with knoppix logan2004 Linux - Software 2 03-25-2005 08:40 PM
Knoppix 3.4 and recovery of data on an IDE RAID Controller system smithtodda Linux - Hardware 1 10-21-2004 06:40 PM
Knoppix & NTFS file recovery Incanus Linux - General 1 06-06-2004 11:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:27 AM.

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
Open Source Consulting | Domain Registration