BTRFS subvolumes
Frank Steinberg
steinberg at ibr.cs.tu-bs.de
Fri Oct 7 08:58:27 CEST 2016
Hi Kerim,
> Am 06.10.2016 um 17:33 schrieb Kerim Güney <kerim at gueney.org>:
>
> Hey Frank,
>
> I remember that Thomas and I had specifically decided against implementing that functionality. setup-storage is supposed to only create a single subvolume per btrfs partition.
I respect the developers’ decision. But is there a reason? This would make FAI not that fully automated. ;-)
> The unnecessary mkfs calls do surprise me, though. I probably won't be able to check it out until the weekend but could you please email me a sample configuration similar to what you initially tried to use?
disk_config disk1 disklabel:msdos bootable:1
primary /boot 512 ext4 rw
primary swap 4G swap rw
primary - 20G- - -
disk_config btrfs
btrfs single / disk1.3 subvol=@root,defaults,noatime,compress=lzo
btrfs single /opt disk1.3 subvol=@opt,defaults,noatime,compress=lzo
btrfs single /var/lib/mysql disk1.3 subvol=@mysql,defaults,noatime,nodatacow
>
> Best regards
>
> Am 6. Oktober 2016 10:49:44 MESZ, schrieb Frank Steinberg <steinberg at ibr.cs.tu-bs.de>:
> 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“);
>
>
>
>
>
> --
> Diese Nachricht wurde von meinem Mobiltelefon gesendet. Bitte entschuldigen Sie meine Knappheit.
> --
> This Email was sent via my cellphone. Please excuse my brevity.
More information about the linux-fai
mailing list