4

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.

2
  • 1
    Silly thing, I know, but I might as well just point out for the sake of reference that users home is actually /home/username, and /home is for all users Feb 20, 2015 at 10:06
  • Good point! I know that I will correct my question.
    – Dan
    Feb 20, 2015 at 10:11

1 Answer 1

0

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.

1
  • Aren't snapshots READ-ONLY?
    – unfa
    Mar 5 at 23:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .