Tranferring existing VPS to linode - BTRFS subvolume as root
Hi all,
I am trying to transfer a VPS on another hosting provider to a linode instance. The old one is running Arch, which boots from a subvolume as the root.
On Linode, I create a new Arch vps instance, which installed nicely. Then I converted the ext4 filesystem to a btrfs fs: /dev/sda is now a btrfs FS. I then transferred the root subvolume using btrfs send/receive, which now sits below the btrfs root as a subvolume, just like it did on the old VPS.
The problem now: I cannot get the Linode VPS to boot from that subvolume. Typically, I chroot into the subvolume I want to boot from, then grub-mkconfig and grub-install /dev/sda. It seems to work, it doesn't generate errors. But, upon exiting the chroot and rebooting, it still boots from the old grub: the one that was installed by default.
It this something Linode specific or am I misunderstanding the boot process altogether?
Thanks!
2 Replies
Ah, okay, by starting from a default arch linode I bypassed some necessary documentation: I changed the linode profile so it boots using 'Direct disk' instead of 'Grub2'. That seems to do the trick: it now picks up the intended grub.cfg. Only problem now: the boot complains that it can't find /dev/sda.
ERROR: device '/dev/sda' not found. Skipping fsck.
mount: /new_root: no filesystem type specified.
You are now being dropped into an emergency shell.
sh: can't access tty; job control turned off
[rootfs ]# ^C
For reference, by grub.cfg now looks like this:
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-dadf8348-3cb6-4720-80a1-4c55d6e25d8d' {
load_video
set gfxpayload=keep
insmod gzio
insmod btrfs
set root='hd0'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint- ieee1275='ieee1275//sas/disk@0' --hint-bios=hd0 --hint-efi=hd0 --hint-baremetal=ahci0 dadf8348-3cb6-4720-80a1-4c55d6e25d8d
else
search --no-floppy --fs-uuid --set=root dadf8348-3cb6-4720-80a1-4c55d6e25d8d
fi
echo 'Loading Linux linux-hardened ...'
linux /arch/boot/vmlinuz-linux-hardened root=/dev/sda rw rootflags=subvol=arch console=ttyS0,19200n8 quiet
echo 'Loading initial ramdisk ...'
initrd /arch/boot/initramfs-linux-hardened.img
}
Okay, figured it out:
I moved 'block' in front of 'autodetect' in the /etc/mkinitcpio.conf file. Also added 'btrfs' before 'block' for good measure, not sure which of the changes have affected the result. Then, I rebuilt the kernel: mkinitcpio -p linux & mkinitcpio -p linux-hardened. As I'm running the hardened kernel on the VPS I'm migrating, the system might have misconfigured itself previously.
Anyway, perhaps this can be of help for someone. Consider this issue fixed (nice when it works itself out).