[elbe-users] Image with flat BTRFS Layout
John Ogness
john.ogness at linutronix.de
Mon Nov 18 15:24:31 CET 2024
Hi Steffen,
On 2024-11-18, Müller, Steffen - LT <Mueller.Steffen at litef.de> wrote:
> I want to use ELBE to build an Debian Image with filesystem type BTRFS.
...
> <bylabel>
> <label>BTRFS</label>
> <mountpoint>/</mountpoint>
> <fs>
> <!-- fs type and options -->
> <type>btrfs</type>
> <!-- subvolumes may be specified in fs-finetuning -->
> <fs-finetuning>
> <path-command>btrfs subvolume create {path}/rfs</path-command>
> <path-command>btrfs subvolume create {path}/rfshome</path-command>
> </fs-finetuning>
> </fs>
> <nofstab/>
> </bylabel>
I am not familiar with the fs-finetuning. But I can show something that
worked for me (3 years ago). I did it using project-finetuning. Here are
the relevant snippets from my XML, where /root /home /var /etc were made
to be subvolumes. Partition 1 contains the full rootfs with btrfs.
<target>
...
<pkg-list>
...
<!-- btrfs-progs is needed so that fsck.btrfs is in initramfs -->
<pkg>btrfs-progs</pkg>
</pkg-list>
<project-finetuning>
<losetup img="hd.img">
<!-- rename directories -->
<command part="1">mv $ELBE_MNT/root $ELBE_MNT/root.orig</command>
<command part="1">mv $ELBE_MNT/home $ELBE_MNT/home.orig</command>
<command part="1">mv $ELBE_MNT/var $ELBE_MNT/var.orig</command>
<command part="1">mv $ELBE_MNT/etc $ELBE_MNT/etc.orig</command>
<!-- create subvolumes -->
<command part="1">btrfs subvolume create $ELBE_MNT/root</command>
<command part="1">btrfs subvolume create $ELBE_MNT/home</command>
<command part="1">btrfs subvolume create $ELBE_MNT/var</command>
<command part="1">btrfs subvolume create $ELBE_MNT/etc</command>
<!-- move contents to subvolumes -->
<command part="1">mv $ELBE_MNT/root.orig/* $ELBE_MNT/root/</command>
<command part="1">mv $ELBE_MNT/home.orig/* $ELBE_MNT/home/</command>
<command part="1">mv $ELBE_MNT/var.orig/* $ELBE_MNT/var/</command>
<command part="1">mv $ELBE_MNT/etc.orig/* $ELBE_MNT/etc/</command>
<!-- remove old directories -->
<command part="1">rmdir $ELBE_MNT/root.orig</command>
<command part="1">rmdir $ELBE_MNT/home.orig</command>
<command part="1">rmdir $ELBE_MNT/var.orig</command>
<command part="1">rmdir $ELBE_MNT/etc.orig</command>
</losetup>
</project-finetuning>
</target>
I do not know if this still works with current ELBE versions. And again,
maybe this is not how you are supposed to do it. But perhaps it helps
somehow.
John Ogness
More information about the elbe-users
mailing list