Introduction
I am installing Debian 13 Trixie (recently released as Debian Stable) on a Virtual machine (VM) using the B-TRee File System (BTRFS). The Debian installer supports installing a BTRFS volume to a partition, and creating a single sub volume within. With the terminal I will be modifying a BTRFS volume that spans multiple drives, and contains multiple sub volumes.
A portion of this work will need to be done outside the Debian installer. The most common methods involve either mid install break out or post install. I have not found any information on pre install procedures for this. Looking at the way the Debian installer works this may not be possible.
In this article I will be doing a post install file system modification. To me this seems the most straight forward and easy to understand method.
The Setup
We will be starting with a very basic Debian 13 install. The Net Install ISO File is available from the Debian main site. For this install you can proceed however you are most comfortable, with the exception of drive partitioning.
You will want to only use your main drive at this point,
- chose guided partitioning,
- all files in one partition,
- set the root partition to use btrfs file system.
- When setting setting btrfs, you will want to look at mount options. In my case I chose noatime and compression.
For my VM, the main drive is vda, yours might be listed as sda, nvme0n1, or something else. This will depend on your system and the type of storage drives being used.
Since my main drive is setup as GPT, it now has three partitions; efi, root, and swap. If you are using MBR, you might only have two partitions. Also the swap partition is optional. Since this VM is temporary, I left it. If this was a live system I would probably setup vram for swap space.
Checking Status
I want to first list some commands that can help you monitor your system as you progress. After that I will go through the commands to do the modification to the drives, volumes, and sub volumes.
lsblk
will display all block devices attached to your system. When we start expanding the volume across multiple drives, you can use this command to see them and what they are called.btrfs device add /dev/vdb /
df -h
will display disk usage. The -h option will display space in megabytes or gigabytes, rather than bytes (which is default). You can confirm your mount points and available space.
findmnt –real
will display all mounted drives and their parameters. This command is useful for seeing if mount points are volumes, partitions, or sub volumes.
The Process
Remember to check your progress as you go with some of the above commands. Also remember the commands will differ somewhat depending on your system and drive names. Some commands require root access, so be prepared to use sudo, su, or be logged in as root.
- mount -o subvolid=5 /dev/vda2 /mnt
Mount the volume vda2 to temporary mount point (/mnt). This is a point of confusion. Technically the root sub partition is mounted to “/”, and it is on volume vda2. Kind of weird, but you can do this with btrfs. Don’t want to run this way long term, but for what we are doing here it is okay. - btrfs subvolume create /mnt/@home
Create the home sub partition volume vda2. - umount /mnt
Unmount /dev/vda2 after creating the @home sub partition - mount -o subvol=@home, compress,noatime /dev/vda2 /mnt/
Mount the newly created @home sub volume to /mnt with noatime and compress options - mv /home/<user> /mnt/
Now we want to move our user home folder (/home/<user>) to “/mnt”. This will empty the /home folder in our file system. - umount /mnt
Once our home folder is moved we can unmount the home sub partition from “/mnt”. - mount -o subvol=@home, compress=zstd,noatime /dev/vda2 /home
Next we want to mount the home sub partition to “/home” which should now be empty. After doing this we can check our file system and make sure our home folder is in the correct position.
FSTAB Update
Once we have moved everything around, we need to update the /etc/fstab file. Basically we copy the line for the @rootfs sub partition and duplicate it, then add home information. For example:
UUID=703b0d29-074f-4ac5-a402-a7b6c5313cf5 / btrfs noatime,compress,subvol=@rootfs 0 0
UUID=703b0d29-074f-4ac5-a402-a7b6c5313cf5 /home btrfs noatime,compress,subvol=@home 0 0
Spanning A Volume
The following commands will prepare additional disks and allow spanning of a volume across multiple partitions. For this example I am assuming one additional drive at /dev/vdb. Some commands will require root access as well.
- fdisk /dev/vdb
Option g to create GPT partition table, n to create new partition, and w to write changes to drive. - mount -o subvolid=5 /dev/vda2 /mnt/
Mount the volume to /mnt. We need to expand the volume, not a sub volume. - btrfs device add /dev/vdb1 /mnt
Add the new partition to the volume group. - umount /mnt
Unmount the volume - df -h
Check that the volume (sub volumes) have been expanded with the extra space.
Conclusion
This has been a short listing of the commands for modifying a btrfs file system installed by the Debian installer to have multiple sub volumes and span multiple disks. Please see associated video for more information.