Announcement

Collapse
No announcement yet.

[solved] grub 2 with two disks

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [solved] grub 2 with two disks

    I've searched heaps on this, but nothing I've found tells me this:

    How do I tell grub 2 to write the MBR one disk and find /boot/grub on another?

    The grub-setup and grub-install commands have one device argument, and the doc says they'll write the MBR on that device; there's nowhere to tell it to find grub on another.

    I have added a new disk to my system and want to move my Kubuntu install onto it, so that I can expand the windows partition on the old disk. But before I do, I'd like to have some expectation that it will work.

    TIA
    Regards, John Little

    #2
    Re: grub 2 with two disks

    The additional switch is --root-directory=<YOUR_MOUNTED_TARGET>

    Basically: create the target partition, copy the files to it, mount it (my choice is "/grub2"), then run grub-install.

    In my case I have dedicated grub2 partition. I mounted it as /grub2. Then I copied the contents of /boot/grub to it using the same directory structure. So the mounted directory /grub2 contains /boot/grub and all the files. Then I type in a terminal:


    sudo grub-install --root-directory=/grub2 /dev/sda

    Please Read Me

    Comment


      #3
      Re: grub 2 with two disks

      Thank you, I'll give that a go.
      My reading of the --root-directory option was that it specified a directory, not a device; one might be running grub-install from a live CD, having mounted the grub directory in some place in its virtual file system.

      Originally posted by oshunluvr
      sudo grub-install --root-directory=/grub2 /dev/sda
      Is your grub2 partition on a different device to /dev/sda?
      Regards, John Little

      Comment


        #4
        Re: grub 2 with two disks

        Have a read through here:
        http://kubuntuforums.net/forums/inde...opic=3106368.0

        you can do a lot from the live cd

        Or try the super grub live cd
        HP Pavilion dv6 core i7 (Main)
        4 GB Ram
        Kubuntu 18.10

        Comment


          #5
          Re: grub 2 with two disks

          Originally posted by jlittle
          Thank you, I'll give that a go.
          My reading of the --root-directory option was that it specified a directory, not a device; one might be running grub-install from a live CD, having mounted the grub directory in some place in its virtual file system.

          Is your grub2 partition on a different device to /dev/sda?
          Correct and exactly... /dev/sda is the bootable device. /grub2 is a mounted directory containing the grub2 data files. In my case I keep two copies of the grub2 data directory and all my drives are bootable. In case of a failure of the boot drive, switching to another only requires a BIOS change. If the drive containing grub2 files fails, running the command I posted from a bootable USB or liveCD brings my system back in few minutes.

          Please Read Me

          Comment


            #6
            [Solved] grub 2 with two disks

            Originally posted by oshunluvr
            sudo grub-install --root-directory=/grub2 /dev/sda[/b]
            Well, it didn't work. The computer insisted on booting from the old, first disk. I think I discovered that copying a linux installation by copying partitions in gparted clones the disk uuid and that doesn't play well with grub 2 (even using GRUB_DISABLE_LINUX_UUID=true in /etc/default/grub the search grub command has the uuid).
            Once I used
            Code:
            sudo tune2fs -U random /dev/sdb1
            to change the uuid on the clone, I began to see sanity; I had to update-grub to build a new grub.cfg, and then I could see that grub-mkconfig was seeing first the system I had booted from, and presumably grub-install was too.

            So, I followed the post at http://grub.enbug.org/Grub2LiveCdInstallGuide to chroot to my new, cloned install and then grub-install worked. Maybe the --root-directory switch would have worked if the old install wasn't present, but with the chroot it wasn't necessary.

            P.S.
            Of course, by this time it was late, and Murphy* had his way with me. Incredibly, I inadvertently clicked on kmenu->Leave->Hibernate while gparted was resizing the windows partition! , and Kubuntu crashed, leaving the partition borked. I hadn't meant to click on anything! >
            And then, Kubuntu comes up with ethernet disabled. WTF? Why? Live CD, windows, no problem. Eventually I added eth0 entries to /etc/network/interfaces and
            Code:
            sudo ifconfig eth0 up
            sudo /etc/init.d/networking restart
            But I've no idea why that was necessary.
            *Apologies to the Murphys out there. My Irish grandmother was a Murphy.
            Regards, John Little

            Comment

            Working...
            X