All of lore.kernel.org
 help / color / mirror / Atom feed
* How to create a btrfs snapshot in the rootfs image?
@ 2020-02-22 16:50 fntoth
  2020-02-29 16:00 ` How to create a btrfs snapshot in the rootfs image (during build)? Ferry Toth
  0 siblings, 1 reply; 3+ messages in thread
From: fntoth @ 2020-02-22 16:50 UTC (permalink / raw)
  To: yocto

Hi all,

I am able to generate a rootfs image of type btrfs.
Btrfs supports subvolumes, for instance with name @.

Using subvolumes instead of partitions allow more efficient use of the 
emmc compared to separate partitions. And it allows multiple versions of 
the rootfs in the same pool.

Manually I can create a subvolume (on the host) by loop mounting the 
btrfs image and taking the snapshot. Something like this:
mkdir tmp
sudo mount edison-image.btrfs tmp
sudo btrfs subvolume snapshot tmp tmp/@

and then remove all dir's in root except @.

mount and btrfs operations need root permissions AFAIK. Is there any way 
to add these to the recipe?

There is 2nd thing I want to achieve:
Btrfs can send / receive these snapshots allowing over-the-air-updates.

For this I need to:
sudo btrfs subvolume snapshot -r tmp/@ tmp/@ota
sudo btrfs send tmp/@ota > edison-image.snapshot

And then later manually (with the device having mounted btrfs on /mnt):

cat edison-image.snapshot | ssh root@edison "btrfs receive /mnt"
ssh root@edison "btrfs property set -ts /mnt/@ota ro false"

How do I automated the first steps in yocto?

Ferry




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-13 20:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-22 16:50 How to create a btrfs snapshot in the rootfs image? fntoth
2020-02-29 16:00 ` How to create a btrfs snapshot in the rootfs image (during build)? Ferry Toth
2020-03-13 20:19   ` Gmane Admin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.