===== BTRFS Snapshots =====
The primary reason for XBian using the btrfs filesystem is its automated system for taking snapshots both whenever major system changes are made (such as upgrading the system) and on a scheduled basis. XBian automatically takes a snapshot when apt-get upgrade is run (either from xbian-config or from the console) and takes daily, weekly and monthly snapshots as well.
To manage snapshots, you can easily use xbian-config GUI (Hint: enabling "Advanced Mode" in Preferences gives you additional management functions)
{{wiki:xbian-config-snapshots-640.png}}
or use the command-line tool btrfs-auto-snapshot
==== List existing snapshots ====
To get a list of all existing snapshots, you just have to run \\
\\
//btrfs-auto-snapshot list [{data | home | modules | root}]// \\
\\
with root privilege. Example:
sudo btrfs-auto-snapshot list root
will list all available snapshots for the root partition. The output will look similar to below
root/@
root/@btrfs-auto-snap_daily-2014-06-04-1905
root/@btrfs-auto-snap_weekly-2014-06-04-1905
root/@last_good_known
In this case there are two snapshots available for root - the daily and the weekly one.
==== Restoring a snapshot ====
To restore a snapshot, just run \\
\\
//btrfs-auto-snapshot rollback // \\
\\
with root privilege. The changes will take effect after a reboot. Example:
sudo btrfs-auto-snapshot rollback root/@btrfs-auto-snap_daily-2014-06-04-1905
sudo reboot
==== Removing a snapshot ====
Removing a snapshot - e.g. for getting more disk space - does work analog to the rollback command.
So, you just have to run \\
\\
//btrfs-auto-snapshot destroy // \\
\\
with root privilege. Example:
sudo btrfs-auto-snapshot destroy root/@btrfs-auto-snap_daily-2014-06-04-1905
=== Removing all snapshots at once ===
If you want to remove all existing snapshots at once, just execute: (([[http://forum.xbian.org/post-18701.html#pid18701|Post #18701]] from mk01))
sudo btrfs-auto-snapshot list | grep -v /@$ | grep auto-snap | xargs -L1 sudo btrfs-auto-snapshot destroy