Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
Distribution: Anything NOT SystemD (ie. M$) related.
Posts: 918
Rep:
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.
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:
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.
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)
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.