How can I change the root partition for Debian 10 to boot from?
I'd like to decrease the size of my root filesystem that sits on an LVM logical volume from remote, that is over SSH only and without booting to a Live CD.
Since we can't shrink the rootfs while it's mounted, I figured I'll just clone the existing rootfs, boot to that and do my resizing from there, then boot to the original rootfs and delete the temp one.
I tried in a VM using Ubuntu Server 18.04 since AFAIK it uses the same "boot-chain" as Debain 10. However, I wasn't able to reliably set the cloned partition as root. After a reboot, I checked with
mount and the original root is still used even though
/etc/fstabhas been updated
/boot/grub/grub.cfghas been updated
initramfshas been updated
- 1TB RAID1
- 4TB RAID1
- PV on
- PV on
vg0with both PVs
rootas original root fs (UUID
newrootas temporary root fs (UUID
- ext4 on
- ext4 on
/etc/fstab was changed accordingly (replaced device mapper path).
So far, I've rsync'ed the entire old root
aaa to newroot
bbb, I replaced every occurrence of UUIDs
/boot/grub/grub.cfg (Note: I'm not using
grub2 or UEFI boot).
initramfs was updated using
update-initramfs -u (after fixing
In that order. But my tests in a VM either booted straight to the old root or threw me into a GRUB rescue shell.
update-grub recognized the
newroot volume and added matching entries in
grub.cfg, selecting them manually at boot in my test VM (not possible via SSH...) also booted the old root.
I've also seen there is a
ROOT option for
/etc/initramfs-tools/initramfs.conf to hardcode the root partition:
Allows optional root bootarg hardcoding, when no root bootarg can be passed. A root bootarg overrides that special setting.
But since there is a bootarg for root in my
grub.cfg this setting shouldn't take effect.
What else is there to configure in order to use another UUID as root on next boot?