Trying to move from MBR to GPT raid1 and grub won't startswapon: /dev/sdb1: swapon failed: Invalid argumentUbuntu 14 Raid not bootingDual boot Ubuntu and Windows 10 with GPTHow to stop Ubuntu's Recovery Mode from timing outAccessing grub after Ubuntu 16.04.2 LTS installationInstall RAID0 on 2 GPT SSDs , booting in Legacy Mode, Ubuntu 16.04 DesktopUbuntu 18.04 boot problems/home partition doesn't seem to be mounted in Ubuntu 18.04

If equal temperament divides octave into 12 equal parts, why hertz differences are not the same but element 12th of two?

Who inspired the character Geordi La Forge?

Linear Or nonlinear Black Scholes Equation

Why is 1.e4 c5 2.Nf3 b6 so unpopular?

Is it poor workplace etiquette to display signs of relative "wealth" at work when others are struggling financially?

Examples of problems with non-convex constraint functions but convex feasible region

What's the meaning of Electrical Inches?

Best ways to compress and store tons of CO2?

In this day and age should the definition / categorisation of erotica be revised?

Why didn't Aboriginal Australians discover agriculture?

C# Toy Robot Simulator

Fantasy series about a human girl with gold tattoos who makes too much blood

Stare long enough and you will have found the answer

How to get to Antarctica without using a travel company

Do any languages mark social distinctions other than gender and status?

Do neurons of a neural network model a linear relationship?

If you pass through the order of colors in Prismatic Wall one way, do you reverse the order of colors passing through the other way?

Does Turkey make the "structural steel frame" for the F-35 fighter?

I don't want my ls command in my script to print results on screen

Why is 10.1.255.255 an invalid broadcast address?

A toy model in 0-d QFT

Compress .hex file for micro-controller

How low is the lowest tone that a human can sing?

Probability that any two people have the same birthday?



Trying to move from MBR to GPT raid1 and grub won't start


swapon: /dev/sdb1: swapon failed: Invalid argumentUbuntu 14 Raid not bootingDual boot Ubuntu and Windows 10 with GPTHow to stop Ubuntu's Recovery Mode from timing outAccessing grub after Ubuntu 16.04.2 LTS installationInstall RAID0 on 2 GPT SSDs , booting in Legacy Mode, Ubuntu 16.04 DesktopUbuntu 18.04 boot problems/home partition doesn't seem to be mounted in Ubuntu 18.04






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









0

















I have mdadm raid1 for my boot/root drive.
The disks were partitioned as MBR and I can boot Ubuntu 18.04



One of the drives failed and I replaced it with a 4TB drive and would like to switch to GPT so I can grow the array later.



The new drive is partitioned GPT:



Number Start End Size File system Name Flags
1 1049kB 2097kB 1049kB BIOS boot partition bios_grub
2 2097kB 4001GB 4001GB Linux RAID raid


The old drive is still MBR:



Number Start End Size Type File system Flags
1 1049kB 1000GB 1000GB primary boot, raid


I ran grub-install on the new GPT drive and it finished without errors but I could not boot from the drive.



Next I ran boot-repair and was able to bios boot the new GPT drive, but only when the mirror is present.



When I remove the MBR disk and boot from the GPT disk, I get the same grub rescue mode prompt and it can't find my boot/root lvms. But running ls from rescue lists other raid lvms on differnt mbr disks.



My grub.cfg has:
set root='lvmid/xxxx'



lvmid/xxx is the one grub can't find. The lvmid is correct for /dev/mapper/boot



blkid output:



/dev/mapper/bootdisk-boot: UUID="f13dfe22-a31e-413e-a587-af3f68b82913" TYPE="ext4"
/dev/mapper/bootdisk-data: UUID="702554d1-1113-4aba-bdc0-5db182287343" TYPE="ext4"
/dev/mapper/bootdisk-root: UUID="5b4bc8f5-dc1c-4850-9404-22be00669e23" TYPE="ext4"
/dev/mapper/datavg-datalv: UUID="b6c2eeb5-e868-4b93-89f8-d056f4a43202" TYPE="ext4"
/dev/sda1: PARTLABEL="BIOS boot partition" PARTUUID="a513db1e-893a-4e58-b31f-b848b7adec09"
/dev/sda2: UUID="96535c2c-f839-8d5d-f055-7396b19a6914" UUID_SUB="9a164f93-31ab-e8fc-091b-f95e91e2dfa1" LABEL="bootdisknew:0" TYPE="linux_raid_member" PARTLABEL="Linux RAID" PARTUUID="387427c6-8e47-4c39-8d98-fc1a096164f1"
/dev/sdc1: UUID="96535c2c-f839-8d5d-f055-7396b19a6914" UUID_SUB="2fddbf50-6d71-8724-c8e7-afa45ff686ea" LABEL="bootdisknew:0" TYPE="linux_raid_member" PARTUUID="a5d01761-01"









share|improve this question
































    0

















    I have mdadm raid1 for my boot/root drive.
    The disks were partitioned as MBR and I can boot Ubuntu 18.04



    One of the drives failed and I replaced it with a 4TB drive and would like to switch to GPT so I can grow the array later.



    The new drive is partitioned GPT:



    Number Start End Size File system Name Flags
    1 1049kB 2097kB 1049kB BIOS boot partition bios_grub
    2 2097kB 4001GB 4001GB Linux RAID raid


    The old drive is still MBR:



    Number Start End Size Type File system Flags
    1 1049kB 1000GB 1000GB primary boot, raid


    I ran grub-install on the new GPT drive and it finished without errors but I could not boot from the drive.



    Next I ran boot-repair and was able to bios boot the new GPT drive, but only when the mirror is present.



    When I remove the MBR disk and boot from the GPT disk, I get the same grub rescue mode prompt and it can't find my boot/root lvms. But running ls from rescue lists other raid lvms on differnt mbr disks.



    My grub.cfg has:
    set root='lvmid/xxxx'



    lvmid/xxx is the one grub can't find. The lvmid is correct for /dev/mapper/boot



    blkid output:



    /dev/mapper/bootdisk-boot: UUID="f13dfe22-a31e-413e-a587-af3f68b82913" TYPE="ext4"
    /dev/mapper/bootdisk-data: UUID="702554d1-1113-4aba-bdc0-5db182287343" TYPE="ext4"
    /dev/mapper/bootdisk-root: UUID="5b4bc8f5-dc1c-4850-9404-22be00669e23" TYPE="ext4"
    /dev/mapper/datavg-datalv: UUID="b6c2eeb5-e868-4b93-89f8-d056f4a43202" TYPE="ext4"
    /dev/sda1: PARTLABEL="BIOS boot partition" PARTUUID="a513db1e-893a-4e58-b31f-b848b7adec09"
    /dev/sda2: UUID="96535c2c-f839-8d5d-f055-7396b19a6914" UUID_SUB="9a164f93-31ab-e8fc-091b-f95e91e2dfa1" LABEL="bootdisknew:0" TYPE="linux_raid_member" PARTLABEL="Linux RAID" PARTUUID="387427c6-8e47-4c39-8d98-fc1a096164f1"
    /dev/sdc1: UUID="96535c2c-f839-8d5d-f055-7396b19a6914" UUID_SUB="2fddbf50-6d71-8724-c8e7-afa45ff686ea" LABEL="bootdisknew:0" TYPE="linux_raid_member" PARTUUID="a5d01761-01"









    share|improve this question




























      0












      0








      0








      I have mdadm raid1 for my boot/root drive.
      The disks were partitioned as MBR and I can boot Ubuntu 18.04



      One of the drives failed and I replaced it with a 4TB drive and would like to switch to GPT so I can grow the array later.



      The new drive is partitioned GPT:



      Number Start End Size File system Name Flags
      1 1049kB 2097kB 1049kB BIOS boot partition bios_grub
      2 2097kB 4001GB 4001GB Linux RAID raid


      The old drive is still MBR:



      Number Start End Size Type File system Flags
      1 1049kB 1000GB 1000GB primary boot, raid


      I ran grub-install on the new GPT drive and it finished without errors but I could not boot from the drive.



      Next I ran boot-repair and was able to bios boot the new GPT drive, but only when the mirror is present.



      When I remove the MBR disk and boot from the GPT disk, I get the same grub rescue mode prompt and it can't find my boot/root lvms. But running ls from rescue lists other raid lvms on differnt mbr disks.



      My grub.cfg has:
      set root='lvmid/xxxx'



      lvmid/xxx is the one grub can't find. The lvmid is correct for /dev/mapper/boot



      blkid output:



      /dev/mapper/bootdisk-boot: UUID="f13dfe22-a31e-413e-a587-af3f68b82913" TYPE="ext4"
      /dev/mapper/bootdisk-data: UUID="702554d1-1113-4aba-bdc0-5db182287343" TYPE="ext4"
      /dev/mapper/bootdisk-root: UUID="5b4bc8f5-dc1c-4850-9404-22be00669e23" TYPE="ext4"
      /dev/mapper/datavg-datalv: UUID="b6c2eeb5-e868-4b93-89f8-d056f4a43202" TYPE="ext4"
      /dev/sda1: PARTLABEL="BIOS boot partition" PARTUUID="a513db1e-893a-4e58-b31f-b848b7adec09"
      /dev/sda2: UUID="96535c2c-f839-8d5d-f055-7396b19a6914" UUID_SUB="9a164f93-31ab-e8fc-091b-f95e91e2dfa1" LABEL="bootdisknew:0" TYPE="linux_raid_member" PARTLABEL="Linux RAID" PARTUUID="387427c6-8e47-4c39-8d98-fc1a096164f1"
      /dev/sdc1: UUID="96535c2c-f839-8d5d-f055-7396b19a6914" UUID_SUB="2fddbf50-6d71-8724-c8e7-afa45ff686ea" LABEL="bootdisknew:0" TYPE="linux_raid_member" PARTUUID="a5d01761-01"









      share|improve this question















      I have mdadm raid1 for my boot/root drive.
      The disks were partitioned as MBR and I can boot Ubuntu 18.04



      One of the drives failed and I replaced it with a 4TB drive and would like to switch to GPT so I can grow the array later.



      The new drive is partitioned GPT:



      Number Start End Size File system Name Flags
      1 1049kB 2097kB 1049kB BIOS boot partition bios_grub
      2 2097kB 4001GB 4001GB Linux RAID raid


      The old drive is still MBR:



      Number Start End Size Type File system Flags
      1 1049kB 1000GB 1000GB primary boot, raid


      I ran grub-install on the new GPT drive and it finished without errors but I could not boot from the drive.



      Next I ran boot-repair and was able to bios boot the new GPT drive, but only when the mirror is present.



      When I remove the MBR disk and boot from the GPT disk, I get the same grub rescue mode prompt and it can't find my boot/root lvms. But running ls from rescue lists other raid lvms on differnt mbr disks.



      My grub.cfg has:
      set root='lvmid/xxxx'



      lvmid/xxx is the one grub can't find. The lvmid is correct for /dev/mapper/boot



      blkid output:



      /dev/mapper/bootdisk-boot: UUID="f13dfe22-a31e-413e-a587-af3f68b82913" TYPE="ext4"
      /dev/mapper/bootdisk-data: UUID="702554d1-1113-4aba-bdc0-5db182287343" TYPE="ext4"
      /dev/mapper/bootdisk-root: UUID="5b4bc8f5-dc1c-4850-9404-22be00669e23" TYPE="ext4"
      /dev/mapper/datavg-datalv: UUID="b6c2eeb5-e868-4b93-89f8-d056f4a43202" TYPE="ext4"
      /dev/sda1: PARTLABEL="BIOS boot partition" PARTUUID="a513db1e-893a-4e58-b31f-b848b7adec09"
      /dev/sda2: UUID="96535c2c-f839-8d5d-f055-7396b19a6914" UUID_SUB="9a164f93-31ab-e8fc-091b-f95e91e2dfa1" LABEL="bootdisknew:0" TYPE="linux_raid_member" PARTLABEL="Linux RAID" PARTUUID="387427c6-8e47-4c39-8d98-fc1a096164f1"
      /dev/sdc1: UUID="96535c2c-f839-8d5d-f055-7396b19a6914" UUID_SUB="2fddbf50-6d71-8724-c8e7-afa45ff686ea" LABEL="bootdisknew:0" TYPE="linux_raid_member" PARTUUID="a5d01761-01"






      boot grub2 partitioning raid






      share|improve this question














      share|improve this question











      share|improve this question




      share|improve this question










      asked May 27 at 20:44









      John Paul MorrisonJohn Paul Morrison

      1




      1























          1 Answer
          1






          active

          oldest

          votes


















          0


















          FIXED. Good grief what a pain.



          Short answer: fixed with boot-repair and selecting ATA disk support



          Long answer: replacing/upgrading software RAID1 to larger drives with GPT is doable but tricky.



          First step: make a bootable USB for your system. Not a rescue/livecd - you may want to have one anyway but make sure your own system is bootable from USB. SystemrescueCD booted my system and somehow degraded a different mirror so be careful.



          Optional: I created a virtualbox mock up of my 18.0.4 system with the same MBR RAID1/LVM to test everything. I confirmed some problems/issues with grub-install so it was worth it.



          Bootable USB: I used YUMI/Multiboot and copied my kernel and initrd to the USB /boot and edited /multiboot/syslinux.cfg to add:



          label Mysystem
          menu label Mysystem
          MENU INDENT 1
          KERNEL /boot/vmlinuz-4.15.0-47-generic
          APPEND ro noapic root=/dev/mapper/system-root
          INITRD /boot/initrd.img-4.15.0-47-generic


          Boot-repair



          • You can try the default repair.

          • Note that purging grub will delete /etc/default/grub. With Ubuntu defaults my system would have a kernel panic. Also default Ubuntu grub.cfg hides important boot messages. After trying boot-repair a few times I gave up on purging GRUB and used Advanced options

          • My system ended up needing the ATA disk support

          Converting MBR to GPT



          This assumes you have backups or you're sure you won't have a drive failure while converting. Breaking the mirror and repartitioning is destructive so you will be relying on one drive for a while. Rebuilding mirrors may stress an old drive so you've been warned.



          I had another drive/mirror as a backup in case I needed to recover.



          Fail the drive you want to convert:



          mdadm /dev/md0 --fail /dev/sdb1
          mdadm /dev/md0 -r /dev/sdb1


          Create new GPT partition with gdisk. You need a 1 MB bios-boot for grub. I added an EFI partition in case I move the drives to a new system. Rest of the drive is allocated to RAID and the added back to /dev/md0. It's OK to make a larger RAID partition on the new drive. The original /dev/md0 will stay the same until you grow it.



          after gdisk:
          Number Start (sector) End (sector) Size Code Name
          1 2048 4095 1024.0 KiB EF02 BIOS boot partition
          2 4096 208895 100.0 MiB EF00 EFI System
          3 208896 7814037134 3.6 TiB FD00 Linux RAID


          I had a problem with grub-install failing, and boot-repair not fixing or complaining either (even after purging grub).



          Wiping the bios-boot partition seemed to fix grub-install. Make sure it's the correct drive/partition!



          dd if=/dev/zero of=/dev/sdb1 


          Then: (note the change in raid partition!)



          mdadm /dev/md0 -a /dev/sdb3


          Best to wait for the raid to finish rebuilding. Grub-install should work on the new drive.



          At this point you should have raid1 with your old MBR drive and a new GPT drive. If you're not replacing the MBR drive, you could repeat the process of failing, GPT partitioning and re-adding to /dev/md0.



          But I wanted to replace the MBR drive with a larger one so I had to shut down. This old drive was going to be my backup and I didn't want to fail it in mdadm, just in case there were problems. So I pulled the drive giving me an offline backup.



          If you fail the old drive, replace it and reboot, hopefully Ubuntu boots with a degraded array and you can repartition with GPT and re-add to the array.



          My mdadm radi1 system seems to boot with a degraded mirror, so failing the drive then shutting down might have worked for me.



          However, if your drive actually fails, or you replace it without failing it, Linux may not boot properly and drop you into initramfs.



          The problem is in /scripts/local-block/mdadm:



          mdadm -q --assemble --scan --no-degraded || true


          This prevents starting /dev/md0 properly so it can't mount the root filesystem.



          You can get the system up from the initramfs shell:



          # /dev/md0 is "up" but not mountable so stop it
          mdadm --stop /dev/md0

          # start it degraded
          mdadm -q --assemble --scan

          # if /dev/md0 is extfs it should be mountable now
          # I use lvm and had to start manually:
          lvm vgchange -ay


          You may want to fix the iniramfs scripts. Ubuntu docs may be incorrect about the BOOT_DEGRADED option. The script is /usr/share/initramfs-tools/scripts/local-block/mdadm and you would need to rebuild your initrd etc.



          After booting, you can finish partitioning the replacement drive with GPT and re-installing grub



          Resizing



          The whole point of all this was to use GPT and make use of a larger drive.
          After /dev/md0 was fully synced and the system was working/bootable I extended the RAID, physical volume, logical volume and ext4 filesystems.



          On new larger drives you should have made new, larger RAID partitions. (If you didn't, you should be able increase the partition without data loss using gparted).



          Make sure the array is up and synced [UU] and state clean



          # cat /proc/mdstat
          Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]

          md0 : active raid1 sdb3[3] sda3[2]
          3906783047 blocks super 1.2 [2/2] [UU]
          bitmap: 2/8 pages [8KB], 262144KB chunk

          # mdadm -D /dev/md0
          /dev/md0:
          Version : 1.2
          Creation Time : Thu May 3 22:06:08 2018
          Raid Level : raid1
          Array Size : 3906783047 (3725.80 GiB 4000.55 GB)
          Used Dev Size : 3906783047 (3725.80 GiB 4000.55 GB)
          Raid Devices : 2
          Total Devices : 2
          Persistence : Superblock is persistent

          Intent Bitmap : Internal

          Update Time : Sun Jun 2 13:45:17 2019
          State : clean
          Active Devices : 2
          Working Devices : 2
          Failed Devices : 0
          Spare Devices : 0

          Consistency Policy : bitmap

          Name : mysystem:0 (local to host mysystem)
          UUID : xxxxx
          Events : 1995897

          Number Major Minor RaidDevice State
          3 8 35 0 active sync /dev/sdb3
          2 8 3 1 active sync /dev/sda3


          Now you can extend the system for more disk space



          # Grow the RAID. Docs suggest using a backup file on another drive
          # mdadm didn't seem to use the backup file but doesn't hurt to include

          mdadm --grow --backup-file=/mnt/otherdisk/grow_md0.bak /dev/md0 --size=max

          # Have to grow the physical volume. By default uses all available space
          pvresize /dev/md0

          # You can extend logical volumes or create new ones
          # I extended an existing one to use it all
          lvextend -l +100%FREE /dev/mysystem/data

          #
          resize2fs /dev/mapper/mysystem-data # should be same as /dev/mysystem/data


          At this point, I have a bootable mdadm raid1 and LVM, as well as a backup USB just in case






          share|improve this answer



























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "89"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );














            draft saved

            draft discarded
















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1146652%2ftrying-to-move-from-mbr-to-gpt-raid1-and-grub-wont-start%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown


























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0


















            FIXED. Good grief what a pain.



            Short answer: fixed with boot-repair and selecting ATA disk support



            Long answer: replacing/upgrading software RAID1 to larger drives with GPT is doable but tricky.



            First step: make a bootable USB for your system. Not a rescue/livecd - you may want to have one anyway but make sure your own system is bootable from USB. SystemrescueCD booted my system and somehow degraded a different mirror so be careful.



            Optional: I created a virtualbox mock up of my 18.0.4 system with the same MBR RAID1/LVM to test everything. I confirmed some problems/issues with grub-install so it was worth it.



            Bootable USB: I used YUMI/Multiboot and copied my kernel and initrd to the USB /boot and edited /multiboot/syslinux.cfg to add:



            label Mysystem
            menu label Mysystem
            MENU INDENT 1
            KERNEL /boot/vmlinuz-4.15.0-47-generic
            APPEND ro noapic root=/dev/mapper/system-root
            INITRD /boot/initrd.img-4.15.0-47-generic


            Boot-repair



            • You can try the default repair.

            • Note that purging grub will delete /etc/default/grub. With Ubuntu defaults my system would have a kernel panic. Also default Ubuntu grub.cfg hides important boot messages. After trying boot-repair a few times I gave up on purging GRUB and used Advanced options

            • My system ended up needing the ATA disk support

            Converting MBR to GPT



            This assumes you have backups or you're sure you won't have a drive failure while converting. Breaking the mirror and repartitioning is destructive so you will be relying on one drive for a while. Rebuilding mirrors may stress an old drive so you've been warned.



            I had another drive/mirror as a backup in case I needed to recover.



            Fail the drive you want to convert:



            mdadm /dev/md0 --fail /dev/sdb1
            mdadm /dev/md0 -r /dev/sdb1


            Create new GPT partition with gdisk. You need a 1 MB bios-boot for grub. I added an EFI partition in case I move the drives to a new system. Rest of the drive is allocated to RAID and the added back to /dev/md0. It's OK to make a larger RAID partition on the new drive. The original /dev/md0 will stay the same until you grow it.



            after gdisk:
            Number Start (sector) End (sector) Size Code Name
            1 2048 4095 1024.0 KiB EF02 BIOS boot partition
            2 4096 208895 100.0 MiB EF00 EFI System
            3 208896 7814037134 3.6 TiB FD00 Linux RAID


            I had a problem with grub-install failing, and boot-repair not fixing or complaining either (even after purging grub).



            Wiping the bios-boot partition seemed to fix grub-install. Make sure it's the correct drive/partition!



            dd if=/dev/zero of=/dev/sdb1 


            Then: (note the change in raid partition!)



            mdadm /dev/md0 -a /dev/sdb3


            Best to wait for the raid to finish rebuilding. Grub-install should work on the new drive.



            At this point you should have raid1 with your old MBR drive and a new GPT drive. If you're not replacing the MBR drive, you could repeat the process of failing, GPT partitioning and re-adding to /dev/md0.



            But I wanted to replace the MBR drive with a larger one so I had to shut down. This old drive was going to be my backup and I didn't want to fail it in mdadm, just in case there were problems. So I pulled the drive giving me an offline backup.



            If you fail the old drive, replace it and reboot, hopefully Ubuntu boots with a degraded array and you can repartition with GPT and re-add to the array.



            My mdadm radi1 system seems to boot with a degraded mirror, so failing the drive then shutting down might have worked for me.



            However, if your drive actually fails, or you replace it without failing it, Linux may not boot properly and drop you into initramfs.



            The problem is in /scripts/local-block/mdadm:



            mdadm -q --assemble --scan --no-degraded || true


            This prevents starting /dev/md0 properly so it can't mount the root filesystem.



            You can get the system up from the initramfs shell:



            # /dev/md0 is "up" but not mountable so stop it
            mdadm --stop /dev/md0

            # start it degraded
            mdadm -q --assemble --scan

            # if /dev/md0 is extfs it should be mountable now
            # I use lvm and had to start manually:
            lvm vgchange -ay


            You may want to fix the iniramfs scripts. Ubuntu docs may be incorrect about the BOOT_DEGRADED option. The script is /usr/share/initramfs-tools/scripts/local-block/mdadm and you would need to rebuild your initrd etc.



            After booting, you can finish partitioning the replacement drive with GPT and re-installing grub



            Resizing



            The whole point of all this was to use GPT and make use of a larger drive.
            After /dev/md0 was fully synced and the system was working/bootable I extended the RAID, physical volume, logical volume and ext4 filesystems.



            On new larger drives you should have made new, larger RAID partitions. (If you didn't, you should be able increase the partition without data loss using gparted).



            Make sure the array is up and synced [UU] and state clean



            # cat /proc/mdstat
            Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]

            md0 : active raid1 sdb3[3] sda3[2]
            3906783047 blocks super 1.2 [2/2] [UU]
            bitmap: 2/8 pages [8KB], 262144KB chunk

            # mdadm -D /dev/md0
            /dev/md0:
            Version : 1.2
            Creation Time : Thu May 3 22:06:08 2018
            Raid Level : raid1
            Array Size : 3906783047 (3725.80 GiB 4000.55 GB)
            Used Dev Size : 3906783047 (3725.80 GiB 4000.55 GB)
            Raid Devices : 2
            Total Devices : 2
            Persistence : Superblock is persistent

            Intent Bitmap : Internal

            Update Time : Sun Jun 2 13:45:17 2019
            State : clean
            Active Devices : 2
            Working Devices : 2
            Failed Devices : 0
            Spare Devices : 0

            Consistency Policy : bitmap

            Name : mysystem:0 (local to host mysystem)
            UUID : xxxxx
            Events : 1995897

            Number Major Minor RaidDevice State
            3 8 35 0 active sync /dev/sdb3
            2 8 3 1 active sync /dev/sda3


            Now you can extend the system for more disk space



            # Grow the RAID. Docs suggest using a backup file on another drive
            # mdadm didn't seem to use the backup file but doesn't hurt to include

            mdadm --grow --backup-file=/mnt/otherdisk/grow_md0.bak /dev/md0 --size=max

            # Have to grow the physical volume. By default uses all available space
            pvresize /dev/md0

            # You can extend logical volumes or create new ones
            # I extended an existing one to use it all
            lvextend -l +100%FREE /dev/mysystem/data

            #
            resize2fs /dev/mapper/mysystem-data # should be same as /dev/mysystem/data


            At this point, I have a bootable mdadm raid1 and LVM, as well as a backup USB just in case






            share|improve this answer






























              0


















              FIXED. Good grief what a pain.



              Short answer: fixed with boot-repair and selecting ATA disk support



              Long answer: replacing/upgrading software RAID1 to larger drives with GPT is doable but tricky.



              First step: make a bootable USB for your system. Not a rescue/livecd - you may want to have one anyway but make sure your own system is bootable from USB. SystemrescueCD booted my system and somehow degraded a different mirror so be careful.



              Optional: I created a virtualbox mock up of my 18.0.4 system with the same MBR RAID1/LVM to test everything. I confirmed some problems/issues with grub-install so it was worth it.



              Bootable USB: I used YUMI/Multiboot and copied my kernel and initrd to the USB /boot and edited /multiboot/syslinux.cfg to add:



              label Mysystem
              menu label Mysystem
              MENU INDENT 1
              KERNEL /boot/vmlinuz-4.15.0-47-generic
              APPEND ro noapic root=/dev/mapper/system-root
              INITRD /boot/initrd.img-4.15.0-47-generic


              Boot-repair



              • You can try the default repair.

              • Note that purging grub will delete /etc/default/grub. With Ubuntu defaults my system would have a kernel panic. Also default Ubuntu grub.cfg hides important boot messages. After trying boot-repair a few times I gave up on purging GRUB and used Advanced options

              • My system ended up needing the ATA disk support

              Converting MBR to GPT



              This assumes you have backups or you're sure you won't have a drive failure while converting. Breaking the mirror and repartitioning is destructive so you will be relying on one drive for a while. Rebuilding mirrors may stress an old drive so you've been warned.



              I had another drive/mirror as a backup in case I needed to recover.



              Fail the drive you want to convert:



              mdadm /dev/md0 --fail /dev/sdb1
              mdadm /dev/md0 -r /dev/sdb1


              Create new GPT partition with gdisk. You need a 1 MB bios-boot for grub. I added an EFI partition in case I move the drives to a new system. Rest of the drive is allocated to RAID and the added back to /dev/md0. It's OK to make a larger RAID partition on the new drive. The original /dev/md0 will stay the same until you grow it.



              after gdisk:
              Number Start (sector) End (sector) Size Code Name
              1 2048 4095 1024.0 KiB EF02 BIOS boot partition
              2 4096 208895 100.0 MiB EF00 EFI System
              3 208896 7814037134 3.6 TiB FD00 Linux RAID


              I had a problem with grub-install failing, and boot-repair not fixing or complaining either (even after purging grub).



              Wiping the bios-boot partition seemed to fix grub-install. Make sure it's the correct drive/partition!



              dd if=/dev/zero of=/dev/sdb1 


              Then: (note the change in raid partition!)



              mdadm /dev/md0 -a /dev/sdb3


              Best to wait for the raid to finish rebuilding. Grub-install should work on the new drive.



              At this point you should have raid1 with your old MBR drive and a new GPT drive. If you're not replacing the MBR drive, you could repeat the process of failing, GPT partitioning and re-adding to /dev/md0.



              But I wanted to replace the MBR drive with a larger one so I had to shut down. This old drive was going to be my backup and I didn't want to fail it in mdadm, just in case there were problems. So I pulled the drive giving me an offline backup.



              If you fail the old drive, replace it and reboot, hopefully Ubuntu boots with a degraded array and you can repartition with GPT and re-add to the array.



              My mdadm radi1 system seems to boot with a degraded mirror, so failing the drive then shutting down might have worked for me.



              However, if your drive actually fails, or you replace it without failing it, Linux may not boot properly and drop you into initramfs.



              The problem is in /scripts/local-block/mdadm:



              mdadm -q --assemble --scan --no-degraded || true


              This prevents starting /dev/md0 properly so it can't mount the root filesystem.



              You can get the system up from the initramfs shell:



              # /dev/md0 is "up" but not mountable so stop it
              mdadm --stop /dev/md0

              # start it degraded
              mdadm -q --assemble --scan

              # if /dev/md0 is extfs it should be mountable now
              # I use lvm and had to start manually:
              lvm vgchange -ay


              You may want to fix the iniramfs scripts. Ubuntu docs may be incorrect about the BOOT_DEGRADED option. The script is /usr/share/initramfs-tools/scripts/local-block/mdadm and you would need to rebuild your initrd etc.



              After booting, you can finish partitioning the replacement drive with GPT and re-installing grub



              Resizing



              The whole point of all this was to use GPT and make use of a larger drive.
              After /dev/md0 was fully synced and the system was working/bootable I extended the RAID, physical volume, logical volume and ext4 filesystems.



              On new larger drives you should have made new, larger RAID partitions. (If you didn't, you should be able increase the partition without data loss using gparted).



              Make sure the array is up and synced [UU] and state clean



              # cat /proc/mdstat
              Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]

              md0 : active raid1 sdb3[3] sda3[2]
              3906783047 blocks super 1.2 [2/2] [UU]
              bitmap: 2/8 pages [8KB], 262144KB chunk

              # mdadm -D /dev/md0
              /dev/md0:
              Version : 1.2
              Creation Time : Thu May 3 22:06:08 2018
              Raid Level : raid1
              Array Size : 3906783047 (3725.80 GiB 4000.55 GB)
              Used Dev Size : 3906783047 (3725.80 GiB 4000.55 GB)
              Raid Devices : 2
              Total Devices : 2
              Persistence : Superblock is persistent

              Intent Bitmap : Internal

              Update Time : Sun Jun 2 13:45:17 2019
              State : clean
              Active Devices : 2
              Working Devices : 2
              Failed Devices : 0
              Spare Devices : 0

              Consistency Policy : bitmap

              Name : mysystem:0 (local to host mysystem)
              UUID : xxxxx
              Events : 1995897

              Number Major Minor RaidDevice State
              3 8 35 0 active sync /dev/sdb3
              2 8 3 1 active sync /dev/sda3


              Now you can extend the system for more disk space



              # Grow the RAID. Docs suggest using a backup file on another drive
              # mdadm didn't seem to use the backup file but doesn't hurt to include

              mdadm --grow --backup-file=/mnt/otherdisk/grow_md0.bak /dev/md0 --size=max

              # Have to grow the physical volume. By default uses all available space
              pvresize /dev/md0

              # You can extend logical volumes or create new ones
              # I extended an existing one to use it all
              lvextend -l +100%FREE /dev/mysystem/data

              #
              resize2fs /dev/mapper/mysystem-data # should be same as /dev/mysystem/data


              At this point, I have a bootable mdadm raid1 and LVM, as well as a backup USB just in case






              share|improve this answer




























                0














                0










                0









                FIXED. Good grief what a pain.



                Short answer: fixed with boot-repair and selecting ATA disk support



                Long answer: replacing/upgrading software RAID1 to larger drives with GPT is doable but tricky.



                First step: make a bootable USB for your system. Not a rescue/livecd - you may want to have one anyway but make sure your own system is bootable from USB. SystemrescueCD booted my system and somehow degraded a different mirror so be careful.



                Optional: I created a virtualbox mock up of my 18.0.4 system with the same MBR RAID1/LVM to test everything. I confirmed some problems/issues with grub-install so it was worth it.



                Bootable USB: I used YUMI/Multiboot and copied my kernel and initrd to the USB /boot and edited /multiboot/syslinux.cfg to add:



                label Mysystem
                menu label Mysystem
                MENU INDENT 1
                KERNEL /boot/vmlinuz-4.15.0-47-generic
                APPEND ro noapic root=/dev/mapper/system-root
                INITRD /boot/initrd.img-4.15.0-47-generic


                Boot-repair



                • You can try the default repair.

                • Note that purging grub will delete /etc/default/grub. With Ubuntu defaults my system would have a kernel panic. Also default Ubuntu grub.cfg hides important boot messages. After trying boot-repair a few times I gave up on purging GRUB and used Advanced options

                • My system ended up needing the ATA disk support

                Converting MBR to GPT



                This assumes you have backups or you're sure you won't have a drive failure while converting. Breaking the mirror and repartitioning is destructive so you will be relying on one drive for a while. Rebuilding mirrors may stress an old drive so you've been warned.



                I had another drive/mirror as a backup in case I needed to recover.



                Fail the drive you want to convert:



                mdadm /dev/md0 --fail /dev/sdb1
                mdadm /dev/md0 -r /dev/sdb1


                Create new GPT partition with gdisk. You need a 1 MB bios-boot for grub. I added an EFI partition in case I move the drives to a new system. Rest of the drive is allocated to RAID and the added back to /dev/md0. It's OK to make a larger RAID partition on the new drive. The original /dev/md0 will stay the same until you grow it.



                after gdisk:
                Number Start (sector) End (sector) Size Code Name
                1 2048 4095 1024.0 KiB EF02 BIOS boot partition
                2 4096 208895 100.0 MiB EF00 EFI System
                3 208896 7814037134 3.6 TiB FD00 Linux RAID


                I had a problem with grub-install failing, and boot-repair not fixing or complaining either (even after purging grub).



                Wiping the bios-boot partition seemed to fix grub-install. Make sure it's the correct drive/partition!



                dd if=/dev/zero of=/dev/sdb1 


                Then: (note the change in raid partition!)



                mdadm /dev/md0 -a /dev/sdb3


                Best to wait for the raid to finish rebuilding. Grub-install should work on the new drive.



                At this point you should have raid1 with your old MBR drive and a new GPT drive. If you're not replacing the MBR drive, you could repeat the process of failing, GPT partitioning and re-adding to /dev/md0.



                But I wanted to replace the MBR drive with a larger one so I had to shut down. This old drive was going to be my backup and I didn't want to fail it in mdadm, just in case there were problems. So I pulled the drive giving me an offline backup.



                If you fail the old drive, replace it and reboot, hopefully Ubuntu boots with a degraded array and you can repartition with GPT and re-add to the array.



                My mdadm radi1 system seems to boot with a degraded mirror, so failing the drive then shutting down might have worked for me.



                However, if your drive actually fails, or you replace it without failing it, Linux may not boot properly and drop you into initramfs.



                The problem is in /scripts/local-block/mdadm:



                mdadm -q --assemble --scan --no-degraded || true


                This prevents starting /dev/md0 properly so it can't mount the root filesystem.



                You can get the system up from the initramfs shell:



                # /dev/md0 is "up" but not mountable so stop it
                mdadm --stop /dev/md0

                # start it degraded
                mdadm -q --assemble --scan

                # if /dev/md0 is extfs it should be mountable now
                # I use lvm and had to start manually:
                lvm vgchange -ay


                You may want to fix the iniramfs scripts. Ubuntu docs may be incorrect about the BOOT_DEGRADED option. The script is /usr/share/initramfs-tools/scripts/local-block/mdadm and you would need to rebuild your initrd etc.



                After booting, you can finish partitioning the replacement drive with GPT and re-installing grub



                Resizing



                The whole point of all this was to use GPT and make use of a larger drive.
                After /dev/md0 was fully synced and the system was working/bootable I extended the RAID, physical volume, logical volume and ext4 filesystems.



                On new larger drives you should have made new, larger RAID partitions. (If you didn't, you should be able increase the partition without data loss using gparted).



                Make sure the array is up and synced [UU] and state clean



                # cat /proc/mdstat
                Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]

                md0 : active raid1 sdb3[3] sda3[2]
                3906783047 blocks super 1.2 [2/2] [UU]
                bitmap: 2/8 pages [8KB], 262144KB chunk

                # mdadm -D /dev/md0
                /dev/md0:
                Version : 1.2
                Creation Time : Thu May 3 22:06:08 2018
                Raid Level : raid1
                Array Size : 3906783047 (3725.80 GiB 4000.55 GB)
                Used Dev Size : 3906783047 (3725.80 GiB 4000.55 GB)
                Raid Devices : 2
                Total Devices : 2
                Persistence : Superblock is persistent

                Intent Bitmap : Internal

                Update Time : Sun Jun 2 13:45:17 2019
                State : clean
                Active Devices : 2
                Working Devices : 2
                Failed Devices : 0
                Spare Devices : 0

                Consistency Policy : bitmap

                Name : mysystem:0 (local to host mysystem)
                UUID : xxxxx
                Events : 1995897

                Number Major Minor RaidDevice State
                3 8 35 0 active sync /dev/sdb3
                2 8 3 1 active sync /dev/sda3


                Now you can extend the system for more disk space



                # Grow the RAID. Docs suggest using a backup file on another drive
                # mdadm didn't seem to use the backup file but doesn't hurt to include

                mdadm --grow --backup-file=/mnt/otherdisk/grow_md0.bak /dev/md0 --size=max

                # Have to grow the physical volume. By default uses all available space
                pvresize /dev/md0

                # You can extend logical volumes or create new ones
                # I extended an existing one to use it all
                lvextend -l +100%FREE /dev/mysystem/data

                #
                resize2fs /dev/mapper/mysystem-data # should be same as /dev/mysystem/data


                At this point, I have a bootable mdadm raid1 and LVM, as well as a backup USB just in case






                share|improve this answer














                FIXED. Good grief what a pain.



                Short answer: fixed with boot-repair and selecting ATA disk support



                Long answer: replacing/upgrading software RAID1 to larger drives with GPT is doable but tricky.



                First step: make a bootable USB for your system. Not a rescue/livecd - you may want to have one anyway but make sure your own system is bootable from USB. SystemrescueCD booted my system and somehow degraded a different mirror so be careful.



                Optional: I created a virtualbox mock up of my 18.0.4 system with the same MBR RAID1/LVM to test everything. I confirmed some problems/issues with grub-install so it was worth it.



                Bootable USB: I used YUMI/Multiboot and copied my kernel and initrd to the USB /boot and edited /multiboot/syslinux.cfg to add:



                label Mysystem
                menu label Mysystem
                MENU INDENT 1
                KERNEL /boot/vmlinuz-4.15.0-47-generic
                APPEND ro noapic root=/dev/mapper/system-root
                INITRD /boot/initrd.img-4.15.0-47-generic


                Boot-repair



                • You can try the default repair.

                • Note that purging grub will delete /etc/default/grub. With Ubuntu defaults my system would have a kernel panic. Also default Ubuntu grub.cfg hides important boot messages. After trying boot-repair a few times I gave up on purging GRUB and used Advanced options

                • My system ended up needing the ATA disk support

                Converting MBR to GPT



                This assumes you have backups or you're sure you won't have a drive failure while converting. Breaking the mirror and repartitioning is destructive so you will be relying on one drive for a while. Rebuilding mirrors may stress an old drive so you've been warned.



                I had another drive/mirror as a backup in case I needed to recover.



                Fail the drive you want to convert:



                mdadm /dev/md0 --fail /dev/sdb1
                mdadm /dev/md0 -r /dev/sdb1


                Create new GPT partition with gdisk. You need a 1 MB bios-boot for grub. I added an EFI partition in case I move the drives to a new system. Rest of the drive is allocated to RAID and the added back to /dev/md0. It's OK to make a larger RAID partition on the new drive. The original /dev/md0 will stay the same until you grow it.



                after gdisk:
                Number Start (sector) End (sector) Size Code Name
                1 2048 4095 1024.0 KiB EF02 BIOS boot partition
                2 4096 208895 100.0 MiB EF00 EFI System
                3 208896 7814037134 3.6 TiB FD00 Linux RAID


                I had a problem with grub-install failing, and boot-repair not fixing or complaining either (even after purging grub).



                Wiping the bios-boot partition seemed to fix grub-install. Make sure it's the correct drive/partition!



                dd if=/dev/zero of=/dev/sdb1 


                Then: (note the change in raid partition!)



                mdadm /dev/md0 -a /dev/sdb3


                Best to wait for the raid to finish rebuilding. Grub-install should work on the new drive.



                At this point you should have raid1 with your old MBR drive and a new GPT drive. If you're not replacing the MBR drive, you could repeat the process of failing, GPT partitioning and re-adding to /dev/md0.



                But I wanted to replace the MBR drive with a larger one so I had to shut down. This old drive was going to be my backup and I didn't want to fail it in mdadm, just in case there were problems. So I pulled the drive giving me an offline backup.



                If you fail the old drive, replace it and reboot, hopefully Ubuntu boots with a degraded array and you can repartition with GPT and re-add to the array.



                My mdadm radi1 system seems to boot with a degraded mirror, so failing the drive then shutting down might have worked for me.



                However, if your drive actually fails, or you replace it without failing it, Linux may not boot properly and drop you into initramfs.



                The problem is in /scripts/local-block/mdadm:



                mdadm -q --assemble --scan --no-degraded || true


                This prevents starting /dev/md0 properly so it can't mount the root filesystem.



                You can get the system up from the initramfs shell:



                # /dev/md0 is "up" but not mountable so stop it
                mdadm --stop /dev/md0

                # start it degraded
                mdadm -q --assemble --scan

                # if /dev/md0 is extfs it should be mountable now
                # I use lvm and had to start manually:
                lvm vgchange -ay


                You may want to fix the iniramfs scripts. Ubuntu docs may be incorrect about the BOOT_DEGRADED option. The script is /usr/share/initramfs-tools/scripts/local-block/mdadm and you would need to rebuild your initrd etc.



                After booting, you can finish partitioning the replacement drive with GPT and re-installing grub



                Resizing



                The whole point of all this was to use GPT and make use of a larger drive.
                After /dev/md0 was fully synced and the system was working/bootable I extended the RAID, physical volume, logical volume and ext4 filesystems.



                On new larger drives you should have made new, larger RAID partitions. (If you didn't, you should be able increase the partition without data loss using gparted).



                Make sure the array is up and synced [UU] and state clean



                # cat /proc/mdstat
                Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]

                md0 : active raid1 sdb3[3] sda3[2]
                3906783047 blocks super 1.2 [2/2] [UU]
                bitmap: 2/8 pages [8KB], 262144KB chunk

                # mdadm -D /dev/md0
                /dev/md0:
                Version : 1.2
                Creation Time : Thu May 3 22:06:08 2018
                Raid Level : raid1
                Array Size : 3906783047 (3725.80 GiB 4000.55 GB)
                Used Dev Size : 3906783047 (3725.80 GiB 4000.55 GB)
                Raid Devices : 2
                Total Devices : 2
                Persistence : Superblock is persistent

                Intent Bitmap : Internal

                Update Time : Sun Jun 2 13:45:17 2019
                State : clean
                Active Devices : 2
                Working Devices : 2
                Failed Devices : 0
                Spare Devices : 0

                Consistency Policy : bitmap

                Name : mysystem:0 (local to host mysystem)
                UUID : xxxxx
                Events : 1995897

                Number Major Minor RaidDevice State
                3 8 35 0 active sync /dev/sdb3
                2 8 3 1 active sync /dev/sda3


                Now you can extend the system for more disk space



                # Grow the RAID. Docs suggest using a backup file on another drive
                # mdadm didn't seem to use the backup file but doesn't hurt to include

                mdadm --grow --backup-file=/mnt/otherdisk/grow_md0.bak /dev/md0 --size=max

                # Have to grow the physical volume. By default uses all available space
                pvresize /dev/md0

                # You can extend logical volumes or create new ones
                # I extended an existing one to use it all
                lvextend -l +100%FREE /dev/mysystem/data

                #
                resize2fs /dev/mapper/mysystem-data # should be same as /dev/mysystem/data


                At this point, I have a bootable mdadm raid1 and LVM, as well as a backup USB just in case







                share|improve this answer













                share|improve this answer




                share|improve this answer










                answered Jun 2 at 21:19









                John Paul MorrisonJohn Paul Morrison

                1




                1































                    draft saved

                    draft discarded















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1146652%2ftrying-to-move-from-mbr-to-gpt-raid1-and-grub-wont-start%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown









                    Popular posts from this blog

                    Distance measures on a map of a game The 2019 Stack Overflow Developer Survey Results Are Inmin distance in a graphShortest distance path on contour plotHow to plot a tilted map?Finding points outside of a diskDelaunay link distanceAnnulus from GeoDisks: drawing a ring on a mapNegative Correlation DistanceFind distance along a path (GPS coordinates)Finding position at given distance in a GeoPathMathematics behind distance estimation using camera

                    How to get a smooth, uniform ParametricPlot of a 2D Region?How to plot a complicated Region?How to exclude a region from ParametricPlotHow discretize a region placing vertices on a specific non-uniform gridHow to transform a Plot or a ParametricPlot into a RegionHow can I get a smooth plot of a bounded region?Smooth ParametricPlot3D with RegionFunction?Smooth border of a region ParametricPlotSmooth region boundarySmooth region plot from list of pointsGet minimum y of a certain x in a region

                    Genealogie vun de Merowenger Vum Merowech bis zum Chilperich I. | Navigatiounsmenü