Setup-Storage: how to specify multiple btrfs subvolumes?

Kerim Gueney kgueney at uni-koeln.de
Thu Jan 15 17:26:26 CET 2015


Here is the promised config file. In this example I am using a single 
disk with two different partitions one containing btrfs and the other 
ext4 and with / in btrfs and /home in ext4:

disk_config disk1
primary    /home    50%    ext4    defaults
primary    -   50%   -    -

disk_config btrfs
btrfs    raid1    /    disk1.2    noatime,subvol=@/


The raid1 is in this case redundant, because btrfs uses raid1 for data 
and metadata by default (irrc that's true even for single disk 
configurations, because you can always add a disk later and it kinda 
needs to know how to handle it). However, we decided to make that part 
mandatory.
Also note the "subvol=@/" , setup-storage will not create your / in the 
root of the filesystem but actually create a subvolume for it. It will 
be added to your fstab accordingly.

So that's it. You first define your partitions and the "classical" 
filesystems in the "disk_config disk*" and then in disk_config btrfs 
part, you define all btrfs raids/partitions. If you want both / and 
/home in a subvolume each and each of them in their own paritions, then do:

disk_config disk1
primary    -   50%   -    -
primary    -   50%   -    -

disk_config btrfs
btrfs    raid1    /    disk1.2    noatime,subvol=@/
btrfs    raid1    /home    disk1.1   subvol=@/home


Best regards
Kerim


On 15.01.2015 15:51, Urs Ganse wrote:
> Dear FAI people,
>
> I have a question about the recently added btrfs support, which is not 
> exactly clear to me from the existing documentation:
>
> I am installing systems with a single disk, of which one partition is 
> supposed to contain a btrfs file system.
> To make updating easier, I'd like to have multiple subvolumes in that 
> filesystem, especially I'd like to have the system root in a non-/ 
> default subvolume (so that later on, I can snapshot that subvolume to 
> perform easily-rollback-able upgrades).
>
> How do I specify such a configuration in the setup-storage config? The 
> documentation only gives an example for btrfs lines with subvolumes 
> that use raid configurations, but are not exactly clear about how to 
> specify multiple subvolumes in the same partition. Also, is there a 
> way to specify the default subvolume here?
>
> The formal config file syntax description is missing any mention of 
> the btrfs lines, too.
>
> Cheers,
>
> //Urs



More information about the linux-fai mailing list