uBoot: boot from LVM possible?

Post Reply
crazyquark
Posts: 293
Joined: Thu Jan 15, 2015 4:22 pm
languages_spoken: english, french, romanian
ODROIDs: C1,C1+,C2,HC1,XU4
Has thanked: 0
Been thanked: 0
Contact:

uBoot: boot from LVM possible?

Unread post by crazyquark » Sun Jul 14, 2019 4:09 pm

Hello,

I was getting sick of the sdcard getting corrupted on my odroid-hc1 so I wanted to boot from HDD instead.
However, my disk was using LVM. I quickly realized I cannot boot off an LVM LV.

I repartitioned the disk and added an non-LVM partition in order to boot properly but I am wondering, would it be possible to boot from an LVM logical volume?

(I should say I am using DietPi as the OS not the official Ubuntu which is Debian based)

User avatar
mad_ady
Posts: 6178
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 123 times
Been thanked: 89 times
Contact:

Re: uBoot: boot from LVM possible?

Unread post by mad_ady » Sun Jul 14, 2019 5:32 pm

I'm guessing lvm support needs to be added into the kernel. Do you know what those modules are?

User avatar
meveric
Posts: 10279
Joined: Mon Feb 25, 2013 2:41 pm
languages_spoken: german, english
ODROIDs: X2, U2, U3, XU-Lite, XU3, XU3-Lite, C1, XU4, C2, C1+, XU4Q, HC1, N1, Go, H2 (N4100), N2
Has thanked: 13 times
Been thanked: 103 times
Contact:

Re: uBoot: boot from LVM possible?

Unread post by meveric » Sun Jul 14, 2019 6:55 pm

crazyquark wrote:
Sun Jul 14, 2019 4:09 pm
Hello,

I was getting sick of the sdcard getting corrupted on my odroid-hc1 so I wanted to boot from HDD instead.
However, my disk was using LVM. I quickly realized I cannot boot off an LVM LV.

I repartitioned the disk and added an non-LVM partition in order to boot properly but I am wondering, would it be possible to boot from an LVM logical volume?

(I should say I am using DietPi as the OS not the official Ubuntu which is Debian based)
LVM does work, I boot all my ODROIDs off of LVM as rootfs partitions.
But LVM can be a bit tricky itself and sometimes you need to manually add the modules or command lines to run it to the initramfs to work correctly.

Here are some steps you might want to follow:
  • make sure lvm2 is installed
  • sed -i "/modprobe -q dm-mod/alvm vgchange -ay" /usr/share/initramfs-tools/scripts/local-top/lvm2 (this will add vgchange -ay to the initramfs script which apparently is not loaded correctly)
  • Code: Select all

    update-initramfs -d -k `uname -r`
    update-initramfs -c -k `uname -r`
    update-initramfs -u -k `uname -r`
    
    seems ridiculous but I had it sometimes that an update of the initramfs did not update the scripts inside, so I normally make "very sure" it is
  • make sure /boot/boot.ini points to the LVM device by path not UUID for example: /dev/hdd/root or /dev/mapper/hdd-root or whatever you named your LVM volume and group
  • make sure you set the correct UUID in /etc/fstab
Since DietPi is based on my Debian image and uses my Kernels, I know it works :)
Donate to support my work on the ODROID GameStation Turbo Image for U2/U3 XU3/XU4 X2 X C1 as well as many other releases.
Check out the Games and Emulators section to find some of my work or check the files in my repository to find the software i build for ODROIDs.
If you want to add my repository to your image read my HOWTO integrate my repo into your image.

crazyquark
Posts: 293
Joined: Thu Jan 15, 2015 4:22 pm
languages_spoken: english, french, romanian
ODROIDs: C1,C1+,C2,HC1,XU4
Has thanked: 0
Been thanked: 0
Contact:

Re: uBoot: boot from LVM possible?

Unread post by crazyquark » Sun Jul 14, 2019 8:02 pm

Ah, thanks for that!
I think my mistake was thinking I could use UUID for the boot device, otherwise the lvm2 initramfs script was already OK.

I can now boot from LVM, thank you.

User avatar
meveric
Posts: 10279
Joined: Mon Feb 25, 2013 2:41 pm
languages_spoken: german, english
ODROIDs: X2, U2, U3, XU-Lite, XU3, XU3-Lite, C1, XU4, C2, C1+, XU4Q, HC1, N1, Go, H2 (N4100), N2
Has thanked: 13 times
Been thanked: 103 times
Contact:

Re: uBoot: boot from LVM possible?

Unread post by meveric » Sun Jul 14, 2019 10:11 pm

fun fact is that with Kernel 3.10 and Debian Jessie UUID was working.
But with Kernel 4.14 it did no longer work.
Donate to support my work on the ODROID GameStation Turbo Image for U2/U3 XU3/XU4 X2 X C1 as well as many other releases.
Check out the Games and Emulators section to find some of my work or check the files in my repository to find the software i build for ODROIDs.
If you want to add my repository to your image read my HOWTO integrate my repo into your image.

Post Reply

Return to “Ubuntu”

Who is online

Users browsing this forum: tony.hong and 2 guests