Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Andrei Borzenkov <arvidjaar@gmail.com>
To: thomas <thomas85@mail.ch>, linux-btrfs@vger.kernel.org
Subject: Re: btrfs send subvolume from read-only mount with missing ro=true flag?
Date: Sat, 16 Dec 2023 19:45:26 +0300	[thread overview]
Message-ID: <a5699aee-0e36-4c4c-96b3-aaa04e6b74ea@gmail.com> (raw)
In-Reply-To: <a41a77e3-95aa-450f-9712-c5681f8a8912@mail.ch>

On 16.12.2023 17:47, thomas wrote:
> I have a btrfs volume damaged (it seems beyond repair..) by writing to
> it via an unstable USB connection which disconnected at a particularly
> bad time it seems.
> 
> I found I can still mount said volume in read-only mount using:
> 
> |mount -t btrfs -o ro,rescue=ignorebadroots,rescue=ignoredatacsums
> /dev/ice /mnt/point |
> 
> Now I would have liked to copy some of the subvolumes from that damaged
> volume over to a new one, but sadly |`btrfs send||`| disallows using
> subvolumes that don't already have a ro=true flag on them, so only
> read-only snapshots are allowed as source.
> 
> Can I somehow make |`btrfs send||`| believe that on a read-only mount
> everything is guaranteed to be read-only, even if the subvolume does not
> have that read-only flag? Sadly because I can only mount said damaged
> btrfs volume in read-only mode I can't add the read-only flag to the
> subvolumes I'd like to copy..
> 
> 

Theoretically even if filesystem is mounted ro, it is possible to 
remount it rw on the fly. So one would need to add some mutual exclusion 
between "btrfs send" and "mount -o remount,rw". Not sure how difficult 
it is or whether it is worth the troubles.

What is the exact reason to use "btrfs send" in this case? Why cannot 
you simply archive the content and extract on new filesystem?

  reply	other threads:[~2023-12-16 16:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-16 14:47 btrfs send subvolume from read-only mount with missing ro=true flag? thomas
2023-12-16 16:45 ` Andrei Borzenkov [this message]
2023-12-16 22:55   ` thomas

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=a5699aee-0e36-4c4c-96b3-aaa04e6b74ea@gmail.com \
    --to=arvidjaar@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=thomas85@mail.ch \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox