I am setting up a Fedora 36 kickstart configuration and have the following partitioning commands in the kickstart config file:
# Setup bootloader configuration
bootloader --location=mbr --boot-drive=sda --driveorder=sda --timeout=15
# Remove all partitions from the specified drive
clearpart --drives=sda --all
# EFI Partition (512 MB)
part /boot/efi --fstype="efi" --ondisk=sda --size=600 --fsoptions="umask=0077,shortname=winnt" --label=EFI
# Fedora OS Partition (75 GB)
part btrfs.fedora --fstype="btrfs" --ondisk=sda --size=76800 --fsoptions="noatime,compress-force=zstd:2,space_cache=v2"
btrfs / --label=FEDORA btrfs.fedora
btrfs /.snapshots --subvol --name=btrfs_sv_snapshots LABEL=FEDORA
btrfs /tmp --subvol --name=btrfs_sv_tmp LABEL=FEDORA
btrfs /var/log --subvol --name=btrfs_sv_var_log LABEL=FEDORA
# Home Data Partition (variable size)
part /home --fstype="xfs" --ondisk=sda --size=1024 --grow --label=HOME
When Fedora 36 is installed in a VM using a ks.cfg with the above commands in it, I see the following folders in my / directory:
[root@fedoravm ~]# ls -la /
total 48
dr-xr-xr-x. 1 root root 250 Jul 2 16:39 .
dr-xr-xr-x. 1 root root 250 Jul 2 16:39 ..
dr-xr-xr-x. 1 root root 0 Jan 20 03:04 afs
lrwxrwxrwx. 1 root root 7 Jan 20 03:04 bin -> usr/bin
dr-xr-xr-x. 1 root root 630 Jul 2 16:40 boot
drwxr-xr-x. 1 root root 0 Jul 2 16:38 btrfs_sv_snapshots
drwxrwxrwt. 1 root root 1032 Jul 2 16:40 btrfs_sv_tmp
drwxr-xr-x. 1 root root 158 Jul 2 16:40 btrfs_sv_var_log
drwxr-xr-x. 19 root root 3760 Jul 2 16:40 dev
drwxr-xr-x. 1 root root 2544 Jul 2 16:40 etc
drwxr-xr-x. 3 root root 16 Jul 2 16:40 home
lrwxrwxrwx. 1 root root 7 Jan 20 03:04 lib -> usr/lib
lrwxrwxrwx. 1 root root 9 Jan 20 03:04 lib64 -> usr/lib64
drwxr-xr-x. 1 root root 0 Jan 20 03:04 media
drwxr-xr-x. 1 root root 0 Jan 20 03:04 mnt
drwxr-xr-x. 1 root root 0 Jan 20 03:04 opt
dr-xr-xr-x. 208 root root 0 Jul 2 16:40 proc
dr-xr-x---. 1 root root 244 Jul 2 16:40 root
drwxr-xr-x. 29 root root 700 Jul 2 16:40 run
lrwxrwxrwx. 1 root root 8 Jan 20 03:04 sbin -> usr/sbin
drwxr-xr-x. 1 root root 0 Jul 2 16:38 .snapshots
drwxr-xr-x. 1 root root 0 Jan 20 03:04 srv
dr-xr-xr-x. 13 root root 0 Jul 2 15:40 sys
drwxrwxrwt. 1 root root 1032 Jul 2 16:40 tmp
drwxr-xr-x. 1 root root 100 Jul 2 16:39 usr
drwxr-xr-x. 1 root root 170 Jul 2 16:40 var
I was not expecting to see the following folders:
- btrfs_sv_snapshots
- btrfs_sv_tmp
- btrfs_sv_var_log
I thought a btrfs subvolume name can be anything and doesn’t have to be a valid path. Should I have changed the --name parameter to a valid path for each subvolume ? e.g.
btrfs /.snapshots --subvol --name=/.snapshots LABEL=FEDORA
btrfs /tmp --subvol --name=/tmp LABEL=FEDORA
btrfs /var/log --subvol --name=/var/log LABEL=FEDORA
Here are details of my btrfs setup:
[root@fedoravm ~]# lsblk -ai
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 127G 0 disk
|-sda1 8:1 0 600M 0 part /boot/efi
|-sda2 8:2 0 75G 0 part /var/log
| /tmp
| /.snapshots
| /
`-sda3 8:3 0 51.4G 0 part /home
sr0 11:0 1 670M 0 rom
zram0 252:0 0 3.7G 0 disk [SWAP]
[root@fedoravm ~]# btrfs filesystem show /
Label: 'FEDORA' uuid: 97123c02-8461-4169-92ad-77e036169a4f
Total devices 1 FS bytes used 662.70MiB
devid 1 size 75.00GiB used 4.02GiB path /dev/sda2
[root@fedoravm ~]# btrfs subvolume get-default /
ID 5 (FS_TREE)
[root@fedoravm ~]# btrfs subvolume list -ta /
ID gen top level path
-- --- --------- ----
256 25 5 btrfs_sv_var_log
257 23 5 btrfs_sv_tmp
258 13 5 btrfs_sv_snapshots
259 22 5 var/lib/portables
[root@fedoravm ~]# cat /etc/fstab
#
# /etc/fstab
#
UUID=97123c02-8461-4169-92ad-77e036169a4f / btrfs noatime,compress-force=zstd:2,space_cache=v2 0 0
UUID=97123c02-8461-4169-92ad-77e036169a4f /.snapshots btrfs subvol=btrfs_sv_snapshots,noatime,compress-force=zstd:2,space_cache=v2 0 0
UUID=6809-442B /boot/efi vfat defaults,uid=0,gid=0,umask=077,shortname=winnt 0 2
UUID=0f851e76-64dc-4897-8605-a40883430c5b /home xfs defaults 0 0
UUID=97123c02-8461-4169-92ad-77e036169a4f /tmp btrfs subvol=btrfs_sv_tmp,noatime,compress-force=zstd:2,space_cache=v2 0 0
UUID=97123c02-8461-4169-92ad-77e036169a4f /var/log btrfs subvol=btrfs_sv_var_log,noatime,compress-force=zstd:2,space_cache=v2 0 0
I am trying to setup a flat subvolume layout and it could be that I’ve used incorrect commands to do so.
From reading documentation on BTRFS subvolumes, I understood that “Every btrfs filesystem has a root subvolume, identified as ID=5.” but I thought this was not the same as the Linux / directory which is why I was not expecting to see the btrfs_* folders in my / directory.