Is it safe to use rsync
to restore a btrfs snapshot? Just to give a example rsync -ax /home/snapshot/my_user_folder /home/my_user_folder
where /home
is my home folder and /home/snapshot
is my snapshot of my home folder.
1 Answer
With btrfs a snapshot is also just a subvolume which uses the same files as the original. A copy of this file is created when these files get overwritten in one of the subvolumes. You can move these subvolumes around as much as you want. If you want to restore the snapshot, you could just move the folder. Issue mv /home/username /home/snapshot/backup
and then mv /home/snapshot/somesnapshot /home/username
. This will make the snapshot the new home. If you want to keep the snapshot clean, create a new snapshot of this snapshot.
You can also delete the subvolume the snapshot was based on without issue with btrfs subvolume delete /home/snapshot/backup
ones you're sure it's ok. Because the original files belong to both.
rsync will index the files and copy/overwrite the ones needed. It will be save in the sense that it would do what you'd expect but you'd have two copies of these files on the disk iso one when you move the snapshot.
/home/username
, and/home
is for all users