Proper BTRFS root partition on Proxmox
Selecting BTRFS as the root filesystem during the Proxmox install, will give you exactly that–Proxmox installed in the root (/) volume of the btrfs partition.
Being used to be able to choose my own volume / subvolume layout, I much prefer a tidier structure, where the rootfs is nested in a neat folder structure.
/btrfs_root (/)
+-- __current/
| +-- rootfs
| +-- home
+-- __snapshots/
+-- rootfs.20250101T000000
+-- rootfs.20250102T000000
Now, how does one get that in Proxmox? Well, first, hit up Stack Exchange (this thread), which lays out a clear path. Here, I follow the same approach, adjusted to Proxmox VE 8.4.1. YMMV!
Please mind that in this post root usually refers to the root of the btrfs filesystem, and rootfs denotes the root partition / subvolume of a linux system.
- Create the folder structure for the rootfs that you want.
SUBVOL_PATH=/__current mkdir "${SUBVOL_PATH}" - Make a snapshot the current root partition, it will become the next root (this will change the subvol_id to a number higher than 5 for the root partition, and we need to update grub / fstab later).
ROOT_SUBVOL="${SUBVOL_PATH}"/rootfs btrfs subvolume snapshot / "${ROOT_SUBVOL}" - Update fstab in the snapshot
-UUID=<disk-uuid> / btrfs defaults 0 1 +UUID=<disk-uuid> / btrfs defaults,subvol=/__current/rootfs 0 1 chrootinto the new snapshot to update grub.# mount first SNAP_MOUNT_POINT=/mnt/system mkdir "${SNAP_MOUNT_POINT}" mount -o subvol="${ROOT_SUBVOL}" /dev/sda3 "${SNAP_MOUNT_POINT}" for dir in dev sys proc boot/efi; do mount -o bind /"${dir}" "${SNAP_MOUNT_POINT}/${dir}" done chroot "${SNAP_MOUNT_POINT}" update-grub grub-install --efi-directory=/boot/efi # for good measure exitMind that my installation is using an EFI partition, so I’ve adjusted the grub command (YMMV!).
- after a reboot, the system should report something like
mount | grep " / " /dev/sda3 on / type btrfs ( ... ,subvol=/__current/rootfs) - Now it is cleanup time! Mount the btrfs root to
/mnt/systemor similar, and- move subvolumes if there should be any
- delete the content of the old rootfs (
/mnt/system/{etc,home,...}).
Now every system has the same layout (Proxmox / Archlinux / etc.), and confusion is a thing of the past.
I think.