initramfs: add support for variable partitions layout

Try to find root filesystem by partition label (not filesystem label!).
If that fails, default to 3rd partition according to (new) default
layout.

Fixes QubesOS/qubes-issues#3173
pull/20/merge mm_09e6d2ac
Marek Marczykowski-Górecki 7 years ago
parent e9615899ff
commit 09e6d2ac95
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

@ -56,9 +56,13 @@ log_begin "Waiting for /dev/xvda* devices..."
while ! [ -e /dev/xvda ]; do sleep 0.1; done
log_end
# prefer first partition if exists
# prefer partition if exists
if [ -b /dev/xvda1 ]; then
ROOT_DEV=xvda1
if [ -d /dev/disk/by-partlabel ]; then
ROOT_DEV=$(basename $(readlink "/dev/disk/by-partlabel/Root\\x20filesystem"))
else
ROOT_DEV=xvda3
fi
else
ROOT_DEV=xvda
fi

@ -20,9 +20,18 @@ die() {
echo "Waiting for /dev/xvda* devices..."
while ! [ -e /dev/xvda ]; do sleep 0.1; done
# prefer first partition if exists
# prefer partition if exists
if [ -b /dev/xvda1 ]; then
ROOT_DEV=xvda1
if [ -d /dev/disk/by-partlabel ]; then
ROOT_DEV=$(basename $(readlink "/dev/disk/by-partlabel/Root\\x20filesystem"))
else
ROOT_DEV=$(grep -l "PARTNAME=Root filesystem" /sys/block/xvda/xvda*/uevent |\
grep -o "xvda[0-9]")
fi
if [ -z "$ROOT_DEV" ]; then
# fallback to third partition
ROOT_DEV=xvda3
fi
else
ROOT_DEV=xvda
fi

Loading…
Cancel
Save