BTRFS subvolumes
Frank Steinberg
steinberg at ibr.cs.tu-bs.de
Thu Oct 6 10:49:44 CEST 2016
Hi,
I intend to switch my FAI setups from using ext4 to btrfs, with no RAID levels („single“), but with subvolumes (on a common toplevel volume). With the current setup-storage code, I could not get this working. The main reason is that each volume under the btrfs config section causes a new mkfs.btrfs command, so that subsequent volumes cause unneeded mkfs calls which also override previously created subvolumes.
I am not very familiar with the setup-storage code and its concepts and I am not at all a perl programmer, however the following patch seems to solve my problem as a quick workaround. Maybe it could be useful to others, and maybe it could give Thomas an idea to improve his code.
-frank
--- Commands.pm 2016-07-01 17:31:38.000000000 +0200
+++ Commands.pm.ibr 2016-10-06 10:29:51.462135735 +0200
@@ -354,11 +354,24 @@
}
# creates the BTRFS volume/RAID
if ($raidlevel eq 'single') {
- &FAI::push_command("mkfs.btrfs -d single $createopts ". join(" ", at devs),
+ my $first = 1;
+ my $c = "mkfs.btrfs -d single $createopts ".join(" ", at devs);
+ my $ii = 1; while ($ii < $FAI::n_c_i) {
+ if ($FAI::commands{$ii}{cmd} eq $c) {
+ $first = 0;
+ }
+ $ii++;
+ }
+ if ($first == 0) {
+ &FAI::push_command("true",
"$pre_req",
"btrfs_built_raid_$id");
-
} else {
+ &FAI::push_command("mkfs.btrfs -d single $createopts ". join(" ", at devs),
+ "$pre_req",
+ "btrfs_built_raid_$id");
+ }
+ } else {
&FAI::push_command("mkfs.btrfs -d raid$raidlevel $createopts ". join(" ", at devs),
"$pre_req",
"btrfs_built_raid_$id“);
More information about the linux-fai
mailing list