Not fully sure if this is the right place to share some conclusions of a day of migration experiments, saving others some time. Happy to be redirected to a more appropriate place.
I needed to migrate the root filesystem of a server running Debian from ext4 to btrfs, for which I found https://wiki.debian.org/Btrfs%20migration However, installing a second OS as suggested there did seem rather complicated to me (e.g. wanting to save me the trouble of partition re-layouting and of bootloader adjustments).
Goal was to perform the migration booting from a USB stick. The steps I followed in the end are as follows (credits also to https://forum.level1techs.com/t/moving- ... -fs/210037):
Data migration
Grub update + re-building the initrd image
example /etc/fstab:
I needed to migrate the root filesystem of a server running Debian from ext4 to btrfs, for which I found https://wiki.debian.org/Btrfs%20migration However, installing a second OS as suggested there did seem rather complicated to me (e.g. wanting to save me the trouble of partition re-layouting and of bootloader adjustments).
Goal was to perform the migration booting from a USB stick. The steps I followed in the end are as follows (credits also to https://forum.level1techs.com/t/moving- ... -fs/210037):
Data migration
- Boot from rescue system (I was using systemrescue from USB, using their Xfce)
- rsynced ext4 content from root filesystem (let's say sda1) to another partition (rsync -aPX)
- Created btrfs on sda1 (you can probably also use btrfs-convert, I wanted a clean start)
- btrfs subvolume create @rootfs (on sda1)
- rsync data back, into @rootfs
Grub update + re-building the initrd image
- mount -o subvol=@rootfs /dev/sda1 /mnt
- mount --bind /dev /mnt/dev
- mount --bind /proc /mnt/proc
- mount --bind /sys /mnt/sys
- chroot /mnt
- fix /etc/fstab with new blkid (and others if changed)* see example below, using results from 'blkid /dev/sda1'
- dir /lib/modules (and look for the latest kernel version in there)
- dracut -f '' <latest kernel version>
- update-grub
- grub-install /dev/sda1
- exit
- reboot
example /etc/fstab:
Code:
# /dev/sda1UUID=68761783-1af2-xxxx-xxxx-050ebfcbf372 / btrfs defaults,subvol=@rootfs 0 1
Statistics: Posted by KomtGoed — 2025-01-16 21:37 — Replies 0 — Views 8