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/fstab
has been updated/boot/grub/grub.cfg
has been updatedinitramfs
has been updated
Current configuration
- 1TB RAID1
md0
- 4TB RAID1
md1
- PV on
md0
- PV on
md1p1
- VG
vg0
with both PVs - LV
root
as original root fs (UUIDxxx
) - LV
newroot
as temporary root fs (UUIDyyy
) - ext4 on
vg0-root
(UUIDaaa
) - ext4 on
vg0-newroot
(UUIDbbb
)
/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 aaa
and xxx
with bbb
and yyy
in /boot/grub/grub.cfg
(Note: I'm not using grub2
or UEFI boot).
initramfs
was updated using update-initramfs -u
(after fixing /etc/initramfs-tools/conf.d/resume
).
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?