According to the btrfs Readonly snapshots patch it's possible to "set a snapshot readonly/writable on the fly." So I should be able to turn my readonly snapshot (created with btrfs snapshot -r) writable, somehow.

But neither the btrfs subvolume manpage nor any other part of that manpage seems to give a way to do that.

  • As a workaround you could make a writeble shapshot of your readonly snapshot. (I do this if I don't have the Internet to look up this question)
    – matega
    Nov 3 '15 at 7:26

The btrfs manpage fails to document the property subcommand, which I found by grep'ing the source. It's also in btrfs --help.

To set a snapshot to read-write, you do something like this:

btrfs property set -ts /path/to/snapshot ro false

Change that to true to set it to read-only.

You can also use list to see the available properties:

btrfs property list -ts /path/to/snapshot
ro                  Set/get read-only flag of subvolume.

-t specifies the type of object to work on, s means subvolume. Other options are f (filesystem), i (inode), and d (device). If you don't specify, it'll show all applicable ones (for list) or try to guess for get/set.

Edit: in the newest btrfs tools, there is a btrfs-property manpage documenting that subcommand, although it's not mentioned in the main manpage at all. It's also available as the btrfs-property page on the wiki.

(Note: This requires a new-enough btrfs-tools. Apparently on Debian Wheezy, you'll have to install the updated one from wheezy-backports; thanks artfulrobot).

  • 3
    You'll also find that while the kernel APIs evolve and distributions ship with newer and newer kernels, the btrfs-tools found on some same distributions are not always aligned. So you sometimes found yourself having to compile the latest btrfs-tools form the upstreams git repository to be able to use the btrfs features of your kernel (at least that was very much the case a few years ago). Aug 12 '14 at 19:00
  • @StéphaneChazelas Yes, definitely. Though in this case I'm on Debian testing, which has btrfs-tools 3.14, so not that insanely old.
    – derobert
    Aug 12 '14 at 20:30
  • 1
    @mikeserv Indeed, it appears 3.14.2 split them out. I have 3.14.1, which is only a few months older, according to kernel.org git. But even the current man page doesn't mention properties. I checked (and linked to) the current one on the wiki, too. Turns out the is a separate, not-linked manpage for it though.
    – derobert
    Aug 12 '14 at 21:20
  • I needed to install btrfs-tools from Wheezy-backports to get this to work. Jan 27 '15 at 15:12
  • @artfulrobot thank you, note added to the answer.
    – derobert
    Jan 27 '15 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.