Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* btrfs send subvolume from read-only mount with missing ro=true flag?
@ 2023-12-16 14:47 thomas
  2023-12-16 16:45 ` Andrei Borzenkov
  0 siblings, 1 reply; 3+ messages in thread
From: thomas @ 2023-12-16 14:47 UTC (permalink / raw)
  To: linux-btrfs

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


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

* Re: btrfs send subvolume from read-only mount with missing ro=true flag?
  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
  2023-12-16 22:55   ` thomas
  0 siblings, 1 reply; 3+ messages in thread
From: Andrei Borzenkov @ 2023-12-16 16:45 UTC (permalink / raw)
  To: thomas, linux-btrfs

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?

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

* Re: btrfs send subvolume from read-only mount with missing ro=true flag?
  2023-12-16 16:45 ` Andrei Borzenkov
@ 2023-12-16 22:55   ` thomas
  0 siblings, 0 replies; 3+ messages in thread
From: thomas @ 2023-12-16 22:55 UTC (permalink / raw)
  To: linux-btrfs


Thank you for your reply Andrei!

Well yes of course when I can't use btrfs send+receive I have to use 
file based copying instead.
I'd prefer btrfs send+receive, because it's faster easier and feels 
safer to get an exact copy.
With file based tools you always have to think about what options to use 
so you don't miss any important metadata and when I'm already copying 
older snapshots using btrfs send+receive it's a bit annoying to have to 
come up with an alternative method to copy the last non-snapshot version 
which must logically delete and rewrite data that got moved since the 
last snapshot, using extra storage-space it wouldn't have needed if I 
could have used btrfs send+receive.

Kind regards,
Thomas

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

end of thread, other threads:[~2023-12-16 22:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2023-12-16 22:55   ` thomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox