This shows you the differences between two versions of the page.
snapshots [2014/05/29 22:49] curlymo created |
snapshots [2017/12/13 18:43] (current) Nachteule [BTRFS Snapshots] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | **BTRFS Snapshots** | + | ===== BTRFS Snapshots ===== |
- | The primary reason for XBian moving to 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 and weekly snapshots as well. | + | 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: | ||
- | //Restoring a snapshot// | ||
- | Restoring a previous snapshot is a simple as running (taken from THIS post) | ||
<code> | <code> | ||
- | sudo -i | + | sudo btrfs-auto-snapshot list root |
- | btrfs-auto-snapshot list root | + | |
</code> | </code> | ||
- | which will give you a list of all available snaphots similar to below | + | will list all available snapshots for the root partition. The output will look similar to below |
<code> | <code> | ||
- | root/@btrfs-auto-snap_apt-run-2014-03-06-1546 | + | root/@ |
- | root/@btrfs-auto-snap_apt-run-2014-03-09-1420 | + | root/@btrfs-auto-snap_daily-2014-06-04-1905 |
- | root/@btrfs-auto-snap_apt-run-2014-03-26-2247 | + | root/@btrfs-auto-snap_weekly-2014-06-04-1905 |
- | root/@btrfs-auto-snap_daily-2014-03-21-1907 | + | root/@last_good_known |
- | root/@btrfs-auto-snap_daily-2014-03-22-0909 | + | |
- | root/@btrfs-auto-snap_daily-2014-03-27-0109 | + | |
- | root/@btrfs-auto-snap_weekly-2014-03-22-0911 | + | |
- | root/@btrfs-auto-snap_weekly-2014-03-30-0306 | + | |
</code> | </code> | ||
- | You can then restore the snapshot of your choice by running | + | 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 <snapshot>// \\ | ||
+ | \\ | ||
+ | with root privilege. The changes will take effect after a reboot. Example: | ||
+ | |||
+ | <code> | ||
+ | sudo btrfs-auto-snapshot rollback root/@btrfs-auto-snap_daily-2014-06-04-1905 | ||
+ | sudo reboot | ||
+ | </code> | ||
+ | |||
+ | ==== 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 <snapshot>// \\ | ||
+ | \\ | ||
+ | with root privilege. Example: | ||
+ | |||
+ | <code> | ||
+ | sudo btrfs-auto-snapshot destroy root/@btrfs-auto-snap_daily-2014-06-04-1905 | ||
+ | </code> | ||
+ | |||
+ | === 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)) | ||
<code> | <code> | ||
- | sudo -i | + | sudo btrfs-auto-snapshot list | grep -v /@$ | grep auto-snap | xargs -L1 sudo btrfs-auto-snapshot destroy |
- | btrfs-auto-snapshot rollback root/@btrfs-auto-apt_daily-2013-12-11-0758 | + | |
- | reboot | + | |
</code> | </code> |