Newsgroups: alt.os.linux,comp.os.linux.x Date: Sat, 11 Jan 2003 22:34:11 +0100
Thanks so much everyone for the huge response. You guys were a great help, you saved my system, and I learned a lot beyound that.
Here's what I did:
First I scanned my harddisc with gpart. The output looked very much like it could be my partition table, with the first two partitions missing (which is not surprising, since the beginning of the disc was overwritten). Then I called gpart -W /dev/hda /dev/hda to write the guessed partition table to the disc.
Then I called fdisc to create the two missing partitions at the beginning of the disc. This resulted in the partition table being not in disc order. But fdisc has a function to fix the partition order (x for expert, then f). I wrote the partition table to the disc, removed the first partition from /etc/fstab and rebooted using the boot disc:
Everything worked! Next, I recreated the first partition (/boot), updated /etc/fstab, rebooted again, and happily saw that everything was good.
With the gpart output for comparison, the content of /proc/partitions also made sense: It lists the size of each partition in kilobytes. Just for curiosity, I tried to create a partition table with fdisk by putting in the exact numbers in kilobytes. However, this resulted in the partition table NOT having the correct boundaries, thus this wouldn't have worked.
Also thanks for the hint that tar does store file ownership information and special files like devices and fifos.
Jannik
22 0 9873360 hdc 22 1 9871911 hdc1 3 0 40021632 hda 3 1 30712 hda1 3 2 2468592 hda2 3 3 6963264 hda3 3 4 1 hda4 3 5 614848 hda5 3 6 5734480 hda6 3 7 24209608 hda7
./gpart.linux /dev/hda
Begin scan... Possible partition(Linux ext2), size(6800mb), offset(2440mb) Possible extended partition at offset(9240mb) Possible partition(Linux swap), size(600mb), offset(9240mb) Possible partition(Linux ext2), size(5600mb), offset(9841mb) Possible partition(Linux ext2), size(23642mb), offset(15441mb) End scan.
Checking partitions... Partition(Linux ext2 filesystem): primary Partition(Linux swap or Solaris/x86): logical Partition(Linux ext2 filesystem): logical Partition(Linux ext2 filesystem): logical Ok.
Guessed primary partition table: Primary partition(1) type: 131(0x83)(Linux ext2 filesystem) size: 6800mb #s(13926528) s(4998672-18925199) chs: (1023/15/63)-(1023/15/63)d (4959/0/1)-(18774/15/63)r
Primary partition(2) type: 005(0x05)(Extended DOS) size: 29842mb #s(61118064) s(18925200-80043263) chs: (1023/15/63)-(1023/15/63)d (18775/0/1)-(79407/15/63)r
Primary partition(3) type: 000(0x00)(unused) size: 0mb #s(0) s(0-0) chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r
Primary partition(4) type: 000(0x00)(unused) size: 0mb #s(0) s(0-0) chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r
> I have a Linux SuSE 7.2 with two hard discs (hda and hdc). Everything > important resides on hda. I wanted to do a "badblocks -wv /dev/hdc" (a > destructive surface test), but instead I typed "badblocks -wv /dev/hda", > which immediately started to write to the beginning of /dev/hda. > I noticed the error immediately, but the boot sector, partition table and > partition hda1 (which is only a too big /boot volume and not important, I > have kernel, map and menu on a boot disc) are overwritten. > Now I have the situation of a system that is running perfectly at the moment > (I can still post messages in newsgroups...), but I know that upon reboot > everything will be lost. Of course I backup important stuff at the moment > (writing one CD after another), but hda is 40GB and the installation is > valuable also since I installed and configured loads of stuff manually. > Since I can even mount and unmount partitions on hda, it seems the > kernel/system still knows where the partitions are. There must be a copy of > the partition table, at least in memory. Is there any way to restore this > partition table? > Is there a program that creates a partiton table by looking at the hard dis > and partition sizes? > The second option is to copy everything to the second hard disk. But it is > only 10GB. It would fit if things are zipped (a 3GB /usr zips to 1GB), but > then the file ownership data and special files (fifos, devices) are > lost. Does anyone know of a backup procedure that keeps all this stuff? > A million thanks for any answer that comes before the next power failure...
Jannik Meyer