Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What are the commands to use in btrfs in case I want to:

  1. create a (read-only) snapshot of a volume;
  2. (do some experiments in the volume);
  3. and then rollback the volume to the snapshot?
share|improve this question
# take a read-only snapshot:
btrfs sub snap -r fs snapshot

... do things on fs

# rolling back:
btrfs sub del fs # at which point you'll lose those things you've done
                 # if you want to preserve them, just rename fs instead

btrfs sub snap snapshot fs # reinstate snapshot as a read+write fs
btrfs sub del snapshot # delete the non-longer needed read-only snapshot
share|improve this answer
I like how you snapshot the snapshot over the filesystem, instead of attempting to move it. It's elegant in analogy to copying the snapshot, rather than attempting to use and alter it. You might mention that this sequence will end up deleting everything done in the "... do things" step. – Bladt Jun 24 '15 at 15:02

Try from the other side: create R/W snapshot, use it as new main one, do "some experiments" on old one, then just drop contents of old.

Article "BTRFS Fun" can be helpful.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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