Hello, > > > when setting up btrfs with setup-storage, > > > is it possible to configure multiple subvolumes > > > in one partition, like I tried to configure > > > with > > > > > disk_config btrfs fstabkey:uuid > > > btrfs single / disk1.3 subvol=@root > > > btrfs single /var disk1.3 subvol=@root/var > > > btrfs single /usr disk1.3 subvol=@root/usr > > I think this is related to https://bugs.debian.org/964761 > > The output of format.log would help for the bug report. > > The bug can be solved with the attached patch.
There is another bug in setup-storage that strikes with almost the same configuration as above, but when using for example raid1 instead of single. In that case, mkfs.btrfs is called several times on the same raid devices, so that previously created subvolumes get lost. This is because, in contrast to single device btrfs filesystems, setup-storage does not check for raid if the highest level filesystem already exists. This can be solved by the attached patch. I discovered that surprisingly it can happen that, though the output of setup-storage says that for example /dev/sdb3 is going to be mounted on /mnt and that /dev/sdb3 is going to be unmounted, in reality /dev/sda3 is mounted, but /dev/sdb3 is tried to be unmounted, what of course fails. That is why I also changed from unmounting the device to unmounting the mountpoint. Regards Christoph
Index: fai-5.10.3/lib/setup-storage/Commands.pm =================================================================== --- fai-5.10.3.orig/lib/setup-storage/Commands.pm 2022-12-08 13:52:35.000000000 +0100 +++ fai-5.10.3/lib/setup-storage/Commands.pm 2022-12-12 14:06:26.532431415 +0100 @@ -384,7 +384,12 @@ $mkfs_done{join(" ", @devs)} = '1'; } } else { - $btrfs_tool = "mkfs.btrfs -d raid$raidlevel $createopts ".join(" ",@devs); + if (exists $mkfs_done{join(" ", sort @devs)}) { + $btrfs_tool = "true"; + } else { + $btrfs_tool = "mkfs.btrfs -d raid$raidlevel $createopts ".join(" ", sort @devs); + $mkfs_done{join(" ", sort @devs)} = '1'; + } } # nothing more to do if we need to proserve this volume. No mkfs, no subvolume @@ -404,7 +409,7 @@ "btrfs_created_$initial_subvolume"); # unmounting the device itself - &FAI::push_command("umount $devs[0]", + &FAI::push_command("umount /mnt", "btrfs_created_$initial_subvolume", ""); }
signature.asc
Description: This is a digitally signed message part