Exploring btrfs for backups Part 3: The Script in Practice

Night of the second day:

# btrfs sub list /home
ID 275 gen 3201 top level 5 path home
ID 1021 gen 3193 top level 275 path .snapshots
ID 1023 gen 1653 top level 275 path .snapshots/2014-03-13-2146
ID 1024 gen 1697 top level 275 path .snapshots/2014-03-13-2210
ID 1025 gen 1775 top level 275 path .snapshots/2014-03-13-2300
ID 1027 gen 1876 top level 275 path .snapshots/2014-03-14-0000
ID 1028 gen 1961 top level 275 path .snapshots/2014-03-14-0100
ID 1029 gen 2032 top level 275 path .snapshots/2014-03-14-0200
ID 1030 gen 2105 top level 275 path .snapshots/2014-03-14-0300
ID 1031 gen 2211 top level 275 path .snapshots/2014-03-14-0400
ID 1032 gen 2284 top level 275 path .snapshots/2014-03-14-0500
ID 1033 gen 2357 top level 275 path .snapshots/2014-03-14-0600
ID 1035 gen 2430 top level 275 path .snapshots/2014-03-14-0700
ID 1036 gen 2506 top level 275 path .snapshots/2014-03-14-0800
ID 1037 gen 2587 top level 275 path .snapshots/2014-03-14-0900
ID 1038 gen 2667 top level 275 path .snapshots/2014-03-14-1700
ID 1039 gen 2774 top level 275 path .snapshots/2014-03-14-1800
ID 1040 gen 2879 top level 275 path .snapshots/2014-03-14-1900
ID 1041 gen 2982 top level 275 path .snapshots/2014-03-14-2000
ID 1042 gen 3088 top level 275 path .snapshots/2014-03-14-2100
ID 1043 gen 3193 top level 275 path .snapshots/2014-03-14-2200

Morning of the third day:

# btrfs sub list /home
ID 275 gen 4602 top level 5 path home
ID 1021 gen 4558 top level 275 path .snapshots
ID 1025 gen 1775 top level 275 path .snapshots/2014-03-13-2300
ID 1027 gen 1876 top level 275 path .snapshots/2014-03-14-0000
ID 1028 gen 1961 top level 275 path .snapshots/2014-03-14-0100
ID 1029 gen 2032 top level 275 path .snapshots/2014-03-14-0200
ID 1030 gen 2105 top level 275 path .snapshots/2014-03-14-0300
ID 1031 gen 2211 top level 275 path .snapshots/2014-03-14-0400
ID 1032 gen 2284 top level 275 path .snapshots/2014-03-14-0500
ID 1033 gen 2357 top level 275 path .snapshots/2014-03-14-0600
ID 1035 gen 2430 top level 275 path .snapshots/2014-03-14-0700
ID 1036 gen 2506 top level 275 path .snapshots/2014-03-14-0800
ID 1037 gen 2587 top level 275 path .snapshots/2014-03-14-0900
ID 1038 gen 2667 top level 275 path .snapshots/2014-03-14-1700
ID 1039 gen 2774 top level 275 path .snapshots/2014-03-14-1800
ID 1040 gen 2879 top level 275 path .snapshots/2014-03-14-1900
ID 1041 gen 2982 top level 275 path .snapshots/2014-03-14-2000
ID 1042 gen 3088 top level 275 path .snapshots/2014-03-14-2100
ID 1043 gen 3193 top level 275 path .snapshots/2014-03-14-2200
ID 1044 gen 3305 top level 275 path .snapshots/2014-03-14-2300
ID 1045 gen 3418 top level 275 path .snapshots/2014-03-15-0000
ID 1046 gen 3529 top level 275 path .snapshots/2014-03-15-0100
ID 1047 gen 3640 top level 275 path .snapshots/2014-03-15-0200
ID 1048 gen 3754 top level 275 path .snapshots/2014-03-15-0300
ID 1049 gen 3872 top level 275 path .snapshots/2014-03-15-0400
ID 1050 gen 3986 top level 275 path .snapshots/2014-03-15-0500
ID 1052 gen 4102 top level 275 path .snapshots/2014-03-15-0600
ID 1053 gen 4216 top level 275 path .snapshots/2014-03-15-0700
ID 1054 gen 4331 top level 275 path .snapshots/2014-03-15-0800
ID 1055 gen 4445 top level 275 path .snapshots/2014-03-15-0900
ID 1056 gen 4558 top level 275 path .snapshots/2014-03-15-1000

As you can see, it has removed the first two snapshots. Since all three snapshots for the first day were in the last quarter of the day, that is the correct behaviour. Tomorrow we will have a much better demonstration that it is 100% working as it should. To see the cron job go to part 2 of this series. To get the Python script, go to Github.

Author: Eric Mesa

To find out a little more about me, see About Me

1 thought on “Exploring btrfs for backups Part 3: The Script in Practice”

Comments are closed.