I nuked my /boot partition and I'd like it back please
Running Fedora Core 4 on a P4 box. I needed to back up the contents of one server (bsdboxer) to another (johnny5), so I decided to send a tar of a folder across SSH. I however, am a complete idiot, and dumped from the man pages of tar, I did this:
Code:
tar cvfb - 20 stuff/ | ssh johnny5 dd of=/dev/hda1 obs=20b So, there's nothing in /boot now. I tried the advertised "Fedora rescue disk", typed in "linux rescue", was dumped to a terminal, and attempted to see if the drives were still there. An fdisk -l shows that the partitions are still intact, and the /mnt/sysimage still shows the contents of my drive which is great. However, if I try to "chroot /mnt/sysimage", the drives disappear, and I can't even begin to attempt to reinstall the GRUB loader. Rebooting and praying that Knoppix could fix the the day, I wind up at in the face of a terminal and some very mean results. 1. I can see the devices when I do an fdisk -l. The parititions are there and happy, with the /dev/hda1 still being a boot partition, and /dev/hda2 still with the rest of the file system on it. 2. I can't mount either /dev/hda1 or /dev/hda2 to /mnt/hda1 or /mnt/hda2. Something about a wonky magic number error. 3. gpart /dev/hda1 doesn't quite work either. It hangs for a few minutes and I just smash my head on the coffee table a couple of times for the amount of stupidity I've done. 4. I can't do a reinstall of GRUB, well, because GRUB or any other program other than fdisk can't see the partitions. Basically, what I'm asking is if there's anyway for me to fix the MBR and the partition table without having to kill the entire drive. Thanks. |
Breaking news: I tried an fdisk /dev/hda1 (where the boot partition was)
Code:
root@0[/]# fdisk /dev/hda1 |
you need to do:
fdisk /dev/hda not fdisk /dev/hda1 - this will and can not work! |
...but probably everything is ok. - just grub needs to be reinstalled (make a filesystem first...) and your kernel-image copied to /boot
|
Quote:
Code:
root@0[knoppix]# fdisk /dev/hda |
The partition is still there - as was to be expected by looking on what command you gave.
Don't do anything - apart from quitting fdisk without writing to the disk (hit "q"). You tried to mount your partitions from knoppix? /dev/hda2 should be untouched - knoppix might not know how to mount the partition because it is a RAID It is, right? But I'm not sure here because I never have used RAID before. But I think it is safe to assume that this did not get changed since you wrote to /dev/hda1. /dev/hda1 will need a new filesystem on it - dd writes directly to the device without going through the filesystem - so that is messed up probably and its contents are deleted anyway. Look into your /etc/fstab - if you can - for what it WAS when it existed... mkfs.ext2 /dev/hda1 should do the trick - if there was ext2 on it before - which is likely as no journalling filesystem makes sense to have on a partition with just /boot on it |
Quote:
root@1[/]# chroot /mnt/hda1 chroot: cannot run command `/bin/bash': No such file or director ? |
If you want (or need) to chroot you will need to find a way to get your system mounted.
(I mean / and everything under it - with the exeption of /boot - which is on /dev/hda1) Then you mount /dev/hda1 to /boot Then you can chroot... You try to chroot to /dev/hda1 - but there is _nothing_ on it! The whole system is on /dev/hda2 - or on the RAID...you need to get that mounted and then /dev/hda1 to it - as I said... If /dev/hda2 is your OS partition: mount /dev/hda2 to /somewhere mount /dev/hda1 to /somewhere/boot then chroot /somewhere |
Quote:
|
/dev/hda2 is not a RAID? And you can not mount it?
What command did you use? What error did you get? From where were you running the command? |
I don't know FC, but it should do the chroot - maybe it needs the initrd for the LVM support.
Me, I always use Knoppix - can you explain the errors better ???. It should put you in X, not a terminal/console - also remember it always mounts the disks R/O; just remount them. And recreating /boot/grub is only half the job - you'll still need the kernel image, initrd, System.map ... |
Just the kernel-image will do and that should be still there - if he/she compiled a custom kernel - or does Fedora always use an initrd? System map not needed - as far as I know only in lilo.
|
All times are GMT -5. The time now is 10:34 AM. |