I've been playing with two CLI utilities for btrfs, snapper and apt-btrfs-snapshot.
After playing extensively with both I decided to delete apt-btrfs-snapshot. The primary reason is that I didn't want system wide PRE & POST snapsnots eating up HD space everytime I ran apt-get or the muon updater ran. Secondarily, the apt-btrfs-snapshots were created by mounting my partition and saving them as @apt-snapshot-yyyymmddhh:mm:ss, which are not visible without mounting my active partition again.
My Kubuntu partition is 336GB. With only Kubuntu 14.04 installed I was eating about 15% of the partition space. Over a period of five days, with the standard snapper configurations for both / (@) and /home (@home), and all the apt-get snapshots, about 60% of my partition was eaten up. Here is the root config file with my present settings:
My changes took 60 snapshots off of my btrfs installation and gave me 66% free space. / and /home now have 4 snapshots each, instead of 30+, and those 8 snapshots are taking 20% of my partition.
I was curious to see if the /.snapshots directory snapshots contained and data in their "home" subdirectory. They did not. Likewise, my /home/.snapshots directory contained only my ~/jerry directory. So, there is a need when installing snapper to create the second /home account. When one uses snapper and does not signifiy which account to use then the action defaults to the root account. So, if one wants to create a snapshot in ones home account using snapper here is the syntax:
sudo snapper -chome create --description "my snapshot in home"
Without the "-chome" section your snapshot would be a snapshot of / and would be stored in /.snapshots.
Snapper also gives you the ability to do a "pre" and "post" snapshot and include a command in between. Snapper referes to snapshots by the number it creates for them, not by the btrfs ID number. Using the "status" or "diff" switches on snapper you can use the numbers of two snapshots to compare them and see what's changed. If you want to roll back the changes between snapshot #x and snapshot #y then use this command:
sudo -croot undochange x..y
It is important to specifiy either root or home because they both could have the same snapshot numbers (but not the same data) and if you meant to roll back the home account to what it was before "x" you might end up rolling back root instead.
Obviously, something like an apt-get may change both the / and /home/youracct subvolumes. So before you run apt-get sequences you'd run snapper to create a snapshot for both root and home specifying the "--pre-number". After the update you run snapper again with the same "pre" number, which snapper sees as a "post" number.
And, the part that allows you to do a command in between "pre" and "post" snapshots:
Very powerful stuff!
After playing extensively with both I decided to delete apt-btrfs-snapshot. The primary reason is that I didn't want system wide PRE & POST snapsnots eating up HD space everytime I ran apt-get or the muon updater ran. Secondarily, the apt-btrfs-snapshots were created by mounting my partition and saving them as @apt-snapshot-yyyymmddhh:mm:ss, which are not visible without mounting my active partition again.
My Kubuntu partition is 336GB. With only Kubuntu 14.04 installed I was eating about 15% of the partition space. Over a period of five days, with the standard snapper configurations for both / (@) and /home (@home), and all the apt-get snapshots, about 60% of my partition was eaten up. Here is the root config file with my present settings:
Code:
# subvolume to snapshot SUBVOLUME="/" # filesystem type FSTYPE="btrfs" # users and groups allowed to work with config ALLOW_USERS="jerry" ALLOW_GROUPS="" # start comparing pre- and post-snapshot in background after creating # post-snapshot BACKGROUND_COMPARISON="yes" # run daily number cleanup NUMBER_CLEANUP="yes" # limit for number cleanup NUMBER_MIN_AGE="1800" NUMBER_LIMIT="5" [B] <---- initially was 50[/B] NUMBER_LIMIT_IMPORTANT="3" # create hourly snapshots TIMELINE_CREATE="yes" # cleanup hourly snapshots after some time TIMELINE_CLEANUP="yes" # limits for timeline cleanup TIMELINE_MIN_AGE="1800" TIMELINE_LIMIT_HOURLY="0" [B]<------ Initially was 10[/B] TIMELINE_LIMIT_DAILY="1" TIMELINE_LIMIT_MONTHLY="3" TIMELINE_LIMIT_YEARLY="1" # cleanup empty pre-post-pairs EMPTY_PRE_POST_CLEANUP="yes" # limits for empty pre-post-pair cleanup EMPTY_PRE_POST_MIN_AGE="1800" [B] <----- I still don't know what the 1800 means ???[/B]
I was curious to see if the /.snapshots directory snapshots contained and data in their "home" subdirectory. They did not. Likewise, my /home/.snapshots directory contained only my ~/jerry directory. So, there is a need when installing snapper to create the second /home account. When one uses snapper and does not signifiy which account to use then the action defaults to the root account. So, if one wants to create a snapshot in ones home account using snapper here is the syntax:
sudo snapper -chome create --description "my snapshot in home"
Without the "-chome" section your snapshot would be a snapshot of / and would be stored in /.snapshots.
Snapper also gives you the ability to do a "pre" and "post" snapshot and include a command in between. Snapper referes to snapshots by the number it creates for them, not by the btrfs ID number. Using the "status" or "diff" switches on snapper you can use the numbers of two snapshots to compare them and see what's changed. If you want to roll back the changes between snapshot #x and snapshot #y then use this command:
sudo -croot undochange x..y
It is important to specifiy either root or home because they both could have the same snapshot numbers (but not the same data) and if you meant to roll back the home account to what it was before "x" you might end up rolling back root instead.
Obviously, something like an apt-get may change both the / and /home/youracct subvolumes. So before you run apt-get sequences you'd run snapper to create a snapshot for both root and home specifying the "--pre-number". After the update you run snapper again with the same "pre" number, which snapper sees as a "post" number.
...
--pre-number number
For post snapshots the number of the pre snapshot must be provided.
--pre-number number
For post snapshots the number of the pre snapshot must be provided.
--command command
Create a pre and post snapshot and run command in between.
Create a pre and post snapshot and run command in between.
Comment