There is a working Linux on / dev / sda, it has GRUB2 as the boot loader. There is a second screw / dev / sdd with ext2 partition / dev / sdd1. In / dev / sdd1 / boot / linux is the kernel. There is no bootloader on / dev / sdd, there are no files other than the kernel on sdd1 either.

I want to install GRUB2 on / dev / sdd so that it starts as / as the kernel / dev / sdd1 / boot / linux when booting from / dev / sdd. How to do, and even so that the download from / dev / sda does not break?

    2 answers 2

    A terrible crutch option, but in the first approximation it worked:

    mount /dev/sdd1 /mnt 

    copy to / mnt / boot the contents of / boot / grub

     grub-install --boot-dir=/mnt/boot/ /dev/sdd 

    edit /mnt/grub/grub.cfg with the correct kernel file.

      physically disable / dev / sda, start the machine with the only remaining disk, put grub2 (from live cd for example). You connect the disconnected disk back

      • Is it impossible to use the live axis for this business? - Vladimir Martyanov
      • I think that, in general, it does not, because different BIOSes can identify sdd in different ways when it is selected as a boot disk. But maybe lucky. If it's a pity to lose the bootloader on sda, it is better to disable it for the period of experiments - dmityugov
      • Hrinova ... But now, let's say it will be the same machine that the live linux works on with sda. - Vladimir Martyanov
      • In principle, through grub-install I can install the bootloader on / dev / sdd, but it will use the system settings with sda. Through the rescue console, I can select the kernel and start downloading it. But how to save the changes? - Vladimir Martyanov
      • when the boot disk changes, the machine's hardware configuration changes. It is not easy to choose another core; This is to put the bootloader on another hardware. If you do not select sdd as a boot one, you don’t need to install a bootloader on it. I hope I didn’t get very confused - dmityugov