All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Gmane Admin" <gley-yocto@m.gmane-mx.org>
To: yocto@lists.yoctoproject.org
Subject: Re: How to create a btrfs snapshot in the rootfs image (during build)?
Date: Fri, 13 Mar 2020 21:19:04 +0100	[thread overview]
Message-ID: <cdac52db-1702-a552-03cb-6bfe28b75c1d@gmail.com> (raw)
In-Reply-To: <31175.1582992041311691839@lists.yoctoproject.org>

Self answering below.

Op 22-02-2020 om 16:06 schreef Ferry Toth:
 > 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?

Up to now I found I can use udisksctl to mount the image as ordinary user.

However, to create a snapshot it appears I need to own the root 
directory and for that would need an option like mke2fs -E root_owner.

As that doesn't exist, the only workaround I find is to create an ext4 
partition with -E root_owner and then convert to btrfs.

Is there really no better way?

 > 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
 >
 >



      reply	other threads:[~2020-03-13 20:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cdac52db-1702-a552-03cb-6bfe28b75c1d@gmail.com \
    --to=gley-yocto@m.gmane-mx.org \
    --cc=yocto@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.