I nuked my /boot partition and I'd like it back please
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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 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:
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
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help):
you need to do: fdisk /dev/hda not fdisk /dev/hda1 - this will and can not work!
Code:
root@0[knoppix]# fdisk /dev/hda
The number of cylinders for this disk is set to 9729.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 9729 78043770 8e Linux LVM
Command (m for help):
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
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
/dev/hda2 is actually the OS partition. There is a RAID on the box but its a logical drive and it's the only thing that shows up when I attempt to use the Fedora Rescue Disk. /dev/hda1 was the boot partition. I just wiped it with the mkfs.ext2 /dev/hda1 command, and I'm now trying to install GRUB on it, but I'm getting this:
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
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.