Master Multi‑Linux Management: Partition, Btrfs Subvolumes, Bootloader & Virtualization Tricks
This guide explains how to manage a Linux desktop by using a single Btrfs partition with subvolumes, label‑based fstab and bootloader configuration, container and VM techniques, and diskless initramfs setups, enabling easy migration, backup, snapshot, and Windows access without reinstalling each system.
Here I share my experience managing a Linux desktop to avoid common inconveniences such as reinstalling on new hardware, duplicating configurations across machines, switching between Windows and Linux, risky system updates, missing packages, and the need for quick testing of new kernel features.
Buying a new computer requires reinstalling Linux, all software, libraries, development environments and services.
Switching between two computers (A and B) forces re‑doing all configurations.
Running a Linux program from Windows requires rebooting into Linux, which is cumbersome.
System updates (e.g., Arch Linux rolling updates) can break the system and backups are tedious.
Some software is only packaged for Ubuntu, making installation on Arch difficult.
Installing software via make install leaves unmanaged files.
Testing new kernel features often forces the use of a virtual machine.
The solution is to use a single machine that hosts multiple Linux distributions and Windows, with each Linux system residing in a Btrfs subvolume on a large Btrfs partition. The partition has two labels: swap and linux. Subvolumes are created for each distro (e.g., archlinux, ubuntu, kali, debian) and can be mounted, snapshotted, backed up, or deleted at will. Windows can access these Linux systems via VirtualBox using a raw VMDK that points to the physical disk.
Partition and Subvolumes
Create a Btrfs partition, label it linux, and create subvolumes for each distro:
mkswap -L swap /dev/sdb4
mkfs.btrfs -L linux /dev/nvme0n1p4Example subvolume creation:
btrfs subvolume create archlinux
btrfs subvolume create ubuntu
btrfs subvolume create kali
btrfs subvolume create debianIt is recommended not to share a single home directory among different distributions because configuration files may conflict.
System Installation
Two scenarios are covered: fresh installation of a Linux system and migration of an existing system into the subvolume layout.
Fresh Installation
Prefer manual installation over graphical installers to retain control over bootloader and partitioning. For Arch Linux use pacstrap targeting the subvolume:
pacstrap -d /mnt/archlinux base
For Debian/Ubuntu use debootstrap inside the subvolume:
debootstrap --arch amd64 focal /mnt/ubuntu http://archive.ubuntu.com/ubuntu/After installation, write a custom fstab that references partitions by label (e.g., /dev/disk/by-label/linux) and omit the root entry, letting the bootloader pass the root device via kernel parameters.
Existing System Migration
Copy the root filesystem of an existing system to the target subvolume using rsync or btrfs send. Example with rsync:
rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} [email protected]:/ /mnt/ubuntuExample with btrfs send (requires both source and destination to be Btrfs):
btrfs subvolume snapshot -r / /ubuntu
btrfs subvolume delete /mnt/ubuntu
ssh [email protected] btrfs send /ubuntu | btrfs receive /mntBootloader and fstab
Use labels in fstab so the same configuration works on bare metal, in a VM, or after moving the disk to another machine. Do not include a root entry; instead pass root=/dev/disk/by-label/linux and rootflags=subvol=archlinux (or the appropriate subvolume) via bootloader options. Example fstab snippet:
tmpfs /tmp tmpfs defaults 0 0
/dev/disk/by-label/swap none swap defaults,nofail 0 0Install refind as the boot manager. A sample refind entry for Arch Linux:
menuentry ArchLinux {
icon EFI/refind/icons/os_arch.png
volume linux
loader archlinux/boot/vmlinuz-linux
options "root=/dev/disk/by-label/linux rootflags=subvol=archlinux rw"
initrd archlinux/boot/initramfs-linux.img
}For Ubuntu change loader, options and initrd accordingly.
Backup, Restore and Snapshot Use Cases
Create snapshots for backup:
cd /mnt
btrfs subvolume snapshot archlinux backupTo use a snapshot as the root filesystem, simply select it in refind. Snapshots can also be used to test risky software: create a snapshot, boot into it, install the software, and delete the snapshot after testing.
Accessing Linux from Windows
Use VirtualBox with a raw VMDK that points to the physical Linux disk. Create the VMDK:
VBoxManage internalcommands createrawvmdk -filename "C:\Users\gaoxiang\VirtualBox VMs\Linux\localdisk.vmdk" -rawdisk \\.PhysicalDrive2Add the VMDK to a new VM, enable EFI, and replace the default BOOTX64.EFI with a startup script that launches refind:
cd EFI/BOOT
mv bootx64.efi bootx64-backup.efi
echo "EFI efind efind_x64.efi" > startup.nshBoot the VM and select the desired Linux entry.
Linux‑to‑Linux Interaction
Two approaches are presented: containers (using systemd-nspawn) and virtual machines (using KVM with VirtFS). Example container launch:
cd /mnt/debian
systemd-nspawn -bFor VM access, enable 9p filesystem support in the kernel ( CONFIG_NET_9P=y, CONFIG_NET_9P_VIRTIO=y, CONFIG_9P_FS=y, CONFIG_9P_FS_POSIX_ACL=y) or load the modules via /etc/initramfs-tools/modules and rebuild the initramfs.
9p
9pnet
9pnet_virtioLaunch the VM with virtfs to expose the Btrfs subvolume as the root filesystem:
qemu-system-x86_64 -enable-kvm -m 16G -kernel /var/lib/machines/ubuntu/vmlinuz \
-initrd /var/lib/machines/ubuntu/initrd.img \
-virtfs local,id=root9p,path=/var/lib/machines/ubuntu,security_model=passthrough,mount_tag=root9p \
-nographic -append 'root=root9p rw rootfstype=9p rootflags=trans=virtio console=ttyS0 init=/lib/systemd/systemd'Diskless System
A diskless system can be built by packaging the desktop into a compressed cpio initramfs and booting it via refind. Create the initramfs (example for Ubuntu):
cd /mnt/ubuntu
find -mindepth 1 -printf '%P\0' | LANG=C bsdcpio -0 -o -H newc | xz -T 21 -9e --check=crc32 > ../ubuntu.cpio.xzAdd a refind menu entry:
menuentry Ubuntu-diskless {
icon EFI/refind/icons/os_ubuntu.png
volume linux
loader ubuntu/vmlinuz
options "rdinit=/lib/systemd/systemd"
initrd ubuntu.cpio.xz
}This completes the guide.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
