there are few important things to note.
The namings:
btrfs Subvolume - independent data container inside
file system. It is represented as directory of the existing FS. If you create new subvolume, it will be empty, ready to use logical data block inside filesystem. Very convenient to use where data should be logically separated e.g. different VM's or different clients on different subvolumes. This allows very fast
removal of all logical data block with just subvolume delete command.
btrfs Snapshot - a copy of existing
subvolume with all its data at the moment os snapshot done. Can be used as operational backup for reverting settings or changes, e.g. make subvolume snapshot, make changes (VM or data), test if everything is ok, after some grace period remove snapshot.
Important to note: snapshots can be read only (-r
switch) and thus can be used as increment blocks of FS changes and possibly transferred to absolutely another BTRFS!
Current (2016-12-30) BTRFS limitations:
Copying or moving data between subvolumes, e.g. mv dir1/dataset1 dir_subvolume1/
produces all real io to copy data to another subvolume and in case of move, removing from original one.
And very efficient copying of tons of data just by making references and thus using COW feature of BTRFS:
cp -a --reflink=always dir1/dataset1 dir_subvolume1/
and if needed:
rm -rf dir1/dataset1
Read only Subvolume snapshot can be renamed (moved with mv
) at the existing directory level, but cannot be renamed/moved to different subdirectory level. e.g. mv /btrfs/subvol_snap1 /btrfs/.snaphots
is not possible, produces not much explained error: mv: cannot move 'subvol_snap1' to '.snapshots/subvol_snap1': Read-only file system
.
To be able to move such a snapshot, you need to create new read-only snapshot of existing read-only snapshot to the new preferred location, and then remove old one:
btrfs sub snap -r /btrfs/subvol_snap1 /btrfs/.snaphots/subvol_snap1
btrfs sub del /btrfs/subvol_snap1
Just for more easy live:
btrfs sub list /btrfs
I hope this will save tons of time to all new btrfs fans :)
1glad to hear btrfs is working well for you. It's working well for me too so far. No problems. – MountainX – 2012-04-21T23:27:39.633