Re: btrfs with multiple subvolumes in one partition
Christoph Pleger <[email protected]>
| Newsgroups | gmane.linux.debian.fai |
|---|---|
| Message-ID | <[email protected]> |
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
btrfs.patch
(text/x-patch, 1.1 KB)
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
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEHeqYcooFjlnR4zwFcOXIip7d3fEFAmOXOxoACgkQcOXIip7d 3fHYUA/+Kt4xzbRXrjXFeqot1FvZP7tGwyfxa6epN8uhPQoV/FcAlMl3ZEUrvisi 0PcqjU3mV2BGeoK2JaLnISYcLGsJAstsnIGkT0XFmo2N6C6Mfy9XJ8nBc4ccSbE9 SE4L0MvvBJ90kxGOUEbzaEDbYENqAr95yPzl2jcWeS8fxmSySuyG4wMJkofa71zP 6K/izpgXxwetUYZUqSgA4qeenG5wc9vOrOM7dUD6VEDRUEXYG2CKiKBbrUw2xaHc bNWwxoNmOKqLaHQAhKVdRgNOtk126Q7nxGBl9SRLXWvEBr7niWVGxChb1QbS/myY XXlY1lPPEMserN9FnOQGjGlBiczNIUdignssj999W03ByUJvYh0CYKlaOZOoklqR 6DiHhIpGNQ1IkLTRnZSQ2/JbvMsxFBYpoLNED5NFULx4xlBkELy+KRs+XNf+OPCy 4hMR40lcnmnwi2hdz3wwdTben2wyst0o2vXj2iVc3YdgwKDER2Ua6X9ZnThIIzsG lMzxElG0Z2POYxTuJ4xzCXX2evpSTHdX7BoMgdd7NR1qrOd23/lilx6HVcqYobGq Z3MxqVhn5HbNELu5xK1x+LHoDk3nrkkOo048rmYLgCAKlPWBW51tCTOBHl2cBIEQ 3ZE7PGO1yNdT1qNzp+CA2w66WLY8VJRLv17J5x8YCErEzY2lk8M= =h7y3 -----END PGP SIGNATURE-----