What are the commands to use in btrfs in case I want to:
- create a (read-only) snapshot of a volume;
- (do some experiments in the volume);
- and then rollback the volume to the snapshot?
What are the commands to use in btrfs in case I want to:
# 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
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.
btrfs sub del . > Delete subvolume (no-commit): '/mnt/sdc1' > ERROR: cannot delete '/mnt/sdc1': Invalid argument or btrfs sub snap 20170917/ . Create a snapshot of '20170917/' in './20170917' ERROR: cannot snapshot '20170917/': File exists
btrfs as I gave up on it as it had too many stability, performance and reliability issues. It may be more usable now, but the end of the story is that I'm not so familiar with it anymore (not to mentioned that it has probably evolved a lot as well since).
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.