[Buildroot] btrfs filesystem image as subvolume

Robert Heywood robert.heywood at codethink.co.uk
Wed Jan 23 09:44:42 UTC 2019


Hi all.

I wanted the same kind of functionality, but found that mkfs.btrfs doesn't 
support much more than dumping the files into the root of the filesystem.
As a workaround, I made a script that mounts the filesystem, creates the 
subvolume and uses btrfs-send to create the stream.

Sadly it requires root access, so it's not something that can be added to 
buildroot. However, you're welcome to use the script if you want :)

https://github.com/robjh/buildroot-dev/blob/robjh-tmpfiles/robjh/make_btrfs_stream.sh

run it from your buildroot directory with sudo.
It'll produce ./output/images/os.btrfss, which you can use with btrfs-receive.

You might also want to look at this script, which uses the os.btrfss file to 
create a btrfs filesystem on a flash drive, with my desired layout. and with 
compression enabled;

https://github.com/robjh/buildroot-dev/blob/robjh-tmpfiles/robjh/prep_sd.sh

I hope this helps.

kind regards, rob.

On 23/01/2019 09:26, Peter Korsgaard wrote:
>>>>>> "Gervais," == Gervais, Francois <FGervais at distech-controls.com> writes:
> 
> Hi,
> 
>   > Hi,
>   > I tried the btrfs filesystem image and it works fine however in my
>   > use-case I'd like to have only the subvolume and not the whole btrfs
>   > filesystem.
> 
>   > Basically the output of "btrfs send".
> 
>   > I'd first like to make sure this is not possible today and discuss some
>   > high level guidelines you would like me to follow when I implement
>   > the feature.
> 
>   > Should I add a sub-option to the "btrfs root filesystem" menu?
>   > Should if have it's own "Filesystem images" entry?
> 
> Adding Robert who contributed the btrfs support. Robert, any feedback on
> this?
> 

-- 
Robert Heywood, Codethink Ltd.
<blink>Privacy policy; https://www.codethink.co.uk/privacy.html</blink>



More information about the buildroot mailing list