-
Notifications
You must be signed in to change notification settings - Fork 26
Add LVM volume group support if lvm_vg= is specified #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dynparts
Are you sure you want to change the base?
Conversation
Support LVM-backed userdata and rootfs partitions via lvm_vg= cmdline parameter. Activate LVM early in boot process and check for volumes in the specified volume group. If found, /dev/$vg/userdata is used for userdata and /dev/$vg/rootfs overrides any systempart= setting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if instead of making LVM an optional thing via kernel cmdline, whether we should default to LVM instead. That is, if we really want to remove preexisting partition detection.
EDIT: I remember now, that won't work with our multiple recovery ramdisk copies across ports.
| lvm vgscan --mknodes | ||
| lvm vgchange -ay | ||
|
|
||
| if [ -n "$vg" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if can probably go away due to previous duplicate.
| # Make sure the device has been created by udev before we try to mount | ||
| udevadm settle | ||
|
|
||
| # find the right partition |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want those removed? Looks like it would cripple existing setups.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's moved to line 468 below. Raw userdata partition lookup has to happen after LVM activation, because under new scheme the raw userdata partition can also be a part of LVM volume group.
| # Make sure the device has been created by udev before we try to mount | ||
| udevadm settle | ||
|
|
||
| # find the right partition |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's moved to line 468 below. Raw userdata partition lookup has to happen after LVM activation, because under new scheme the raw userdata partition can also be a part of LVM volume group.
| if grep -q lvm_vg= /proc/cmdline; then | ||
| for x in $(cat /proc/cmdline); do | ||
| case ${x} in | ||
| lvm_vg=*) | ||
| vg=${x#*=} | ||
| ;; | ||
| esac | ||
| done | ||
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I think the
grep ...is not really needed, as if there isn't this parameter then the loop below won't find it anyway. - Maybe simply
lvm_vgis too generic. Maybehalium_lvm_vg, but I don't know...
|
So, by simply adding We do call |
| if [ -b /dev/disk/by-partlabel/super ]; then | ||
| tell_kmsg "trying to parse and dmsetup subpartitions from super partition" | ||
| /sbin/parse-android-dynparts /dev/disk/by-partlabel/super | sh | ||
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that the partition label for the new LVM PV will still be super. Does parse-android-dynparts handle this gracefully?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will fail, which is ok, since we don't exit on errors.
It could be a good idea if we could rely on existing |
|
I would recommend Ratchanan's approach, I've been using it in a custom fork of initramfs-tools-halium in |
Support LVM-backed userdata and rootfs partitions via lvm_vg= cmdline parameter. Activate LVM early in boot process and check for volumes in the specified volume group. If found, /dev/$vg/userdata is used for userdata and /dev/$vg/rootfs overrides any systempart= setting.