Fix a non-booting Linux disk

If you boot from a Linux CD, you can switch to your non-booting disk as follows:

1. Find the device that is your non-booting disk.
This could be /dev/sda, /dev/sdb etc. (Disks presented as SCSI)
This could be /dev/hda, /dev/hdb etc. (Disks presented old-style HDs)
Or even /dev/vda etc. (Disks in virtual systems)
2. Mount it, and then remound /dev, /proc, and /sys onto the non-booting disk

mount /dev/sda2 /mnt
mount --rbind /dev /mnt/dev
mount --rbind /sys /mnt/sys
mount --rbind /proc /mnt/proc

3. Set your non-booting disk to root

chroot /mnt

Now you can run your normal commands to fix your boot

grub2-install /dev/sda # restore grub
# Note: you may need to update the Disk UUID in /boot/grub2/grub2.cfg
# to the value returned by blkid /dev/sda2

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *