formatted boot partition
Hello
I formatted /dev/sda1 - boot partition by mistake. Now, after reboot, i have only grub cli. What to do, to restore /boot ? //edit I'm trying restore my empty /boot partition using kali live on usb (My os on hdd is centos, but i have not same os on live usb :/ ) After booting kali live i did: mount /dev/mapper/vg_centosx220-lv_root /mnt/myroot mount /dev/sda1 /mnt/myroot/boot mount ‐‐bind /dev /mnt/myroot/dev mount ‐‐bind /proc /mnt/myroot/proc mount ‐‐bind /sys /mnt/myroot/sys cp -L /etc/resolve.conf /mnt/myroot/etc/resolve.conf then chroot /mnt/myroot gave me error: bash: tty: command not found after ctrl+D chroot /mnt/myroot /bin/bash gave me same error. Neighter apt-get or yum not work in chroot (I don't have initrd.img in chroot) I think on kali there is grub2 and on centos i had 0.97 I have not grub-install package on kali nor to install (apt-get install grub-install) Please help. Is this possible to fix that using kali on usb ? |
It will work better if you use your CentOS installation medium. Did you create the directory /mnt/myroot before starting this? Also, if your initrd is gone then I imagine the kernel is gone also.
|
Yes, i have those folders.
I have /boot on separate partition /dev/sda1, and it's empty (only have lost and foud folder) |
Quote:
|
What partition is / on?
Would it be on /dev/sda2? If so that's, the partition you /mnt/myroot. At present if you were to cd to /mnt/myroot you wouldn't see anything except proc sys and so on. Where as if you mount the / partition you would see your /etc /usr and so on, unless they are on separate paritotions & in that case you would need to mount them also. |
Sorry, i gave you bad info.(1st post corrected)
Root partition / is on lv (/dev/mapper/vg_centosx220-lv_root) Thanks for the tip /usr was also on separated lv - forgot to mount that so i have now: Code:
root@kali:~# lsblk I checked existed newest kernel Code:
root@kali:/# rpm -V kernel-2.6.32-431.29.2.el6.x86_64 Code:
root@kali:/# yum reinstall kernel-2.6.32-431.29.2.el6.x86_64 Code:
root@kali:/# grub-install /dev/sda Btw. do i need install initrd ? |
Quote:
https://www.gnu.org/software/grub/ma...2dinstall.html A simple sample grub.conf file at the link below: http://wiki.centos.org/HowTos/GrubInstallation |
So i need create grub.conf ?
What will be grub designation for root / partition if it's lv ? ( i showed you lsblk before). (hd0,1) ? Till now i typed to grub.conf: default=0 timeout=10 title CentOS 6.5 root (hd0,1) ?? kernel /boot/vmlinuz-2.6.32-431.29.2.el6.x86_64 ro root=/dev/sda2?? rhgb noquiet initrd /boot/initramfs-2.6.32-431.29.2.el6.x86_64.img I don't understand bolded parts Is this will be good grub.conf ? |
In the second link I posted above, read section 5.1 about the entries if you have a separate boot partition. According to that, your root line should be: root (hd0,0) since that is where the kernel and initrd are.
The part at the end of the kernel line should be: root=/dev/sda2 if the rest of the filesystem is on sda2. That's the way I understand it. Make a note of any changes you make so you know what you have done. I don't use CentOS or a separate boot partition but the page above makes sense. |
i switched root=/dev/sda2 to /dev/mapper/vg_centosx220-lv_root, because after reboot i had somekind drakut problem.
After reboot, i saw problems with checking filesystems i typed fsck -fp /dev/mapper/vg_centosx220-lv_var but it didn't helped after reboot. So i had to uncomment this (and few more filesystems) in /etc/fstab Then i got another problem with: fsck.ext4: Unable To Resolve UUID so i switched uuid to /dev/sda1 near /boot partition. But now , after long booting (inj plymount) I see only Centos 6 grafic, and nothing else. |
It would be helpful if you were more specific about what 'problem' you have whether it is with dracut or uuid. Someone might recognize it. I don't use CentOS and have never used LVM so don't really know what you need there. You might try googling the problem specific to Red Hat/CentOS or posting more details here.
|
Problem solved.
Once again i typed uuid for my device, and it worked well/ I think maybe uuid changed itself. |
All times are GMT -5. The time now is 08:03 AM. |