So I installed a second drive in my system today, and instead of typing "mkfs.ext3 /dev/sda1" I did a "mkfs.ext3 /dev/hda1". Fortunately, that was just my /boot partition. I thought I could just copy the contents from the /boot partition from another system, but that didn't work as expected. The again, I don't have another system that's identical to the mine.
What is the best way to re-create the /boot partition for my system?
Alfred
Alfred von Campe wrote:
So I installed a second drive in my system today, and instead of typing "mkfs.ext3 /dev/sda1" I did a "mkfs.ext3 /dev/hda1". Fortunately, that was just my /boot partition. I thought I could just copy the contents from the /boot partition from another system, but that didn't work as expected. The again, I don't have another system that's identical to the mine.
What is the best way to re-create the /boot partition for my system?
grub.conf will be the main problem... and possibly whats in the initrd if extra drivers need to be loaded to complete the boot (I believe this is built by mkinitrd)
# ls -lR /boot /boot: total 9931 -rw-r--r-- 1 root root 62154 Jul 10 04:34 config-2.6.18-8.1.8.el5 -rw-r--r-- 1 root root 62150 Mar 15 17:19 config-2.6.18-8.el5 drwxr-xr-x 2 root root 1024 Jul 23 17:59 grub -rw------- 1 root root 2206532 Jul 23 17:59 initrd-2.6.18-8.1.8.el5.img -rw------- 1 root root 2206505 Jul 23 10:30 initrd-2.6.18-8.el5.img drwx------ 2 root root 12288 Jul 23 03:22 lost+found -rw-r--r-- 1 root root 80032 Apr 1 07:49 message -rw-r--r-- 1 root root 83542 Jul 10 04:34 symvers-2.6.18-8.1.8.el5.gz -rw-r--r-- 1 root root 83542 Mar 15 17:20 symvers-2.6.18-8.el5.gz -rw-r--r-- 1 root root 884809 Jul 10 04:34 System.map-2.6.18-8.1.8.el5 -rw-r--r-- 1 root root 884787 Mar 15 17:19 System.map-2.6.18-8.el5 -rw-r--r-- 1 root root 1765588 Jul 10 04:34 vmlinuz-2.6.18-8.1.8.el5 -rw-r--r-- 1 root root 1765428 Mar 15 17:19 vmlinuz-2.6.18-8.el5
/boot/grub: total 207 -rw-r--r-- 1 root root 63 Jul 23 10:32 device.map -rw-r--r-- 1 root root 7616 Jul 23 10:32 e2fs_stage1_5 -rw-r--r-- 1 root root 7456 Jul 23 10:32 fat_stage1_5 -rw-r--r-- 1 root root 6720 Jul 23 10:32 ffs_stage1_5 -rw------- 1 root root 738 Jul 23 17:59 grub.conf -rw-r--r-- 1 root root 6720 Jul 23 10:32 iso9660_stage1_5 -rw-r--r-- 1 root root 8192 Jul 23 10:32 jfs_stage1_5 lrwxrwxrwx 1 root root 11 Jul 23 10:32 menu.lst -> ./grub.conf -rw-r--r-- 1 root root 6880 Jul 23 10:32 minix_stage1_5 -rw-r--r-- 1 root root 9248 Jul 23 10:32 reiserfs_stage1_5 -rw-r--r-- 1 root root 5427 Apr 1 07:49 splash.xpm.gz -rw-r--r-- 1 root root 512 Jul 23 10:32 stage1 -rw-r--r-- 1 root root 104924 Jul 23 10:32 stage2 -rw-r--r-- 1 root root 7040 Jul 23 10:32 ufs2_stage1_5 -rw-r--r-- 1 root root 6272 Jul 23 10:32 vstafs_stage1_5 -rw-r--r-- 1 root root 8864 Jul 23 10:32 xfs_stage1_5
On Mon, 2007-08-20 at 12:30 -0700, John R Pierce wrote:
Alfred von Campe wrote:
So I installed a second drive in my system today, and instead of typing "mkfs.ext3 /dev/sda1" I did a "mkfs.ext3 /dev/hda1". Fortunately, that was just my /boot partition. I thought I could
just
copy the contents from the /boot partition from another system, but that didn't work as expected. The again, I don't have another
system
that's identical to the mine.
A few more details about the failure mode might get you better help - "didn't work as expected" is not very descriptive. Did you try to reboot? What happened? What else have you tried? Can you boot from rescue media? What is currently in /boot/...?
http://catb.org/~esr/faqs/smart-questions.html
What is the best way to re-create the /boot partition for my system?
grub.conf will be the main problem... and possibly whats in the initrd if extra drivers need to be loaded to complete the boot (I believe this is built by mkinitrd)
May also need to fix /boot/grub/device.map.
Recreating /boot/grub/grub.conf will require knowledge of the partitioning and filesystem layout. Do you have a boot partition? Where is / (root partition)? Using LVM? Using partition labels? Look at /etc/fstab to see what is to be mounted where. This should give you clues as to what belongs on the kernel line in /boot/grub/grub.conf.
You will likely need to create a new initrd-<version>.img for at least the latest kernel. For the latest CentOS 5 kernel the command would be:
# mkinitrd -f /boot/initrd-2.6.18-8.1.8.el5.img 2.6.18-8.1.8.el5
A forced reinstall of the kernel, as suggested elsewhere in the thread, could do this for you but may be tricky when booting from rescue media. The rpm installer script for the kernel might also get confused if /boot/grub/grub.conf is incorrect as it seems to use existing GRUB entries as a model for new ones.
Good luck, Phil
A few more details about the failure mode might get you better help - "didn't work as expected" is not very descriptive. Did you try to reboot? What happened? What else have you tried? Can you boot from rescue media? What is currently in /boot/...?
The answer to the last question is "nothing". It was the /boot partition I accidentally did a mkfs on! And "didn't work as expected" simply means that the system didn't boot. Fortunately, my root partition an all the other partitions where not affected. Thanks to the earlier replies from Ross Walker, I was able to recover my system using roughly the following steps:
1. Boot from CentOS 4.5 CD #1 in rescue mode 2. chroot /mnt/sysimage 3. mount /dev/hda1 /boot 4. rpm -e grub kernel 5. yum install grub kernel 6. e2label /dev/hda1 /boot 7. reboot
Whew! I was really sweating bullets for a couple of hours. I would have hated to rebuild this system from the ground up (the OS is the easy part as I have a kickstart script, but I've installed Oracle and a bunch of other things that would have taken days to reinstall).
Anyway, thanks all for the replies, I am now up and running again.
Alfred
-----Original Message----- From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of Alfred von Campe Sent: Monday, August 20, 2007 3:24 PM To: CentOS mailing list Subject: [CentOS] HELP, I accidentally initialized my /boot partition
So I installed a second drive in my system today, and instead of typing "mkfs.ext3 /dev/sda1" I did a "mkfs.ext3 /dev/hda1". Fortunately, that was just my /boot partition. I thought I could just copy the contents from the /boot partition from another system, but that didn't work as expected. The again, I don't have another system that's identical to the mine.
What is the best way to re-create the /boot partition for my system?
Just re-install the current kernel and grub with an rpm -Uvh --force.
initrd images are auto-generated and grub should probe your disk layout and put some best-guess entries in there.
Just edit menu.lst and fix the entries.
-Ross
______________________________________________________________________ This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution or copying of this e-mail, and any attachments thereto, is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender and permanently delete the original and any copy or printout thereof.
-----Original Message----- From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of Ross S. W. Walker Sent: Monday, August 20, 2007 3:40 PM To: CentOS mailing list Subject: RE: [CentOS] HELP, I accidentally initialized my /boot partition
-----Original Message----- From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of Alfred von Campe Sent: Monday, August 20, 2007 3:24 PM To: CentOS mailing list Subject: [CentOS] HELP, I accidentally initialized my /boot
partition
So I installed a second drive in my system today, and instead of typing "mkfs.ext3 /dev/sda1" I did a "mkfs.ext3 /dev/hda1". Fortunately, that was just my /boot partition. I thought I could just copy the contents from the /boot partition from
another system,
but that didn't work as expected. The again, I don't have another system that's identical to the mine.
What is the best way to re-create the /boot partition for my system?
Just re-install the current kernel and grub with an rpm -Uvh --force.
initrd images are auto-generated and grub should probe your disk layout and put some best-guess entries in there.
Just edit menu.lst and fix the entries.
Actually, just re-install grub first and when you re-install the kernel it will automatically add a grub entry for that kernel!
-Ross
______________________________________________________________________ This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution or copying of this e-mail, and any attachments thereto, is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender and permanently delete the original and any copy or printout thereof.