Mittwoch, 23. November 2011

[Quick view:] btrfs & snapper

The real great feature in openSUSE 12.1 for me (as I am a server administrator) is btrfs & snapper. After installing the new server environment i guess its time to talk about this feature a bit in detail.

  • btrfs - Its just a new filesystem. Often spoken as Butter FS or Better FS. The development started in 2007. Now a days i guess its a good decision if you like ZFS cause it provides mostly the same features but it is GPL and it runs on Linux :-)
    Some information

    (Wikipedia)

  • snapper - snapper is a tool written by the SUSE guys to make btrfs snapshots and of course handle them


Lets take a closer look

openSUSE handles snapshots in two very cute ways. First of all we have timeline snapshots to take a look on the timeline config  /etc/snapper/configs/root contains the information you are looking for.

But lets take a look on what happens
snapper list

shows you the list of snapshots
Type   | #  | Pre # | Date                     | Cleanup  | Description   | Userdata
-------+----+-------+--------------------------+----------+---------------+---------
single | 0  |       |                          |          | current       |
pre    | 1  |       | Sun Nov 20 18:09:05 2011 | number   | yast firewall |
post   | 2  | 1     | Sun Nov 20 18:09:21 2011 | number   |               |
single | 3  |       | Sun Nov 20 18:15:02 2011 | timeline | timeline      |
pre    | 4  |       | Sun Nov 20 18:17:15 2011 | number   | zypp(zypper)  |
post   | 5  | 4     | Sun Nov 20 18:17:16 2011 | number   |               |
pre    | 8  |       | Sun Nov 20 18:17:54 2011 | number   | zypp(zypper)  |
post   | 9  | 8     | Sun Nov 20 18:17:55 2011 | number   |               |
pre    | 10 |       | Sun Nov 20 18:18:05 2011 | number   | yast runlevel |
post   | 11 | 10    | Sun Nov 20 18:18:22 2011 | number   |               |
pre    | 12 |       | Sun Nov 20 18:18:43 2011 | number   | zypp(zypper)  |
post   | 13 | 12    | Sun Nov 20 18:19:07 2011 | number   |               |
single | 19 |       | Mon Nov 21 00:15:01 2011 | timeline | timeline      |
single | 28 |       | Mon Nov 21 09:15:02 2011 | timeline | timeline      |
single | 29 |       | Mon Nov 21 10:15:01 2011 | timeline | timeline      |
single | 30 |       | Mon Nov 21 11:15:01 2011 | timeline | timeline      |
single | 31 |       | Mon Nov 21 12:15:01 2011 | timeline | timeline      |
single | 32 |       | Mon Nov 21 13:15:01 2011 | timeline | timeline      |
single | 33 |       | Mon Nov 21 14:15:02 2011 | timeline | timeline      |
single | 34 |       | Mon Nov 21 15:15:01 2011 | timeline | timeline      |
single | 35 |       | Mon Nov 21 16:15:01 2011 | timeline | timeline      |
single | 36 |       | Mon Nov 21 17:15:01 2011 | timeline | timeline      |
single | 37 |       | Mon Nov 21 18:15:02 2011 | timeline | timeline      |
single | 38 |       | Mon Nov 21 19:15:01 2011 | timeline | timeline      |
single | 39 |       | Mon Nov 21 20:15:02 2011 | timeline | timeline      |
single | 40 |       | Mon Nov 21 21:15:01 2011 | timeline | timeline      |
single | 41 |       | Mon Nov 21 22:15:01 2011 | timeline | timeline      |
single | 42 |       | Mon Nov 21 23:15:01 2011 | timeline | timeline      |
single | 43 |       | Tue Nov 22 00:15:01 2011 | timeline | timeline      |
single | 44 |       | Tue Nov 22 01:15:01 2011 | timeline | timeline      |
single | 45 |       | Tue Nov 22 02:15:01 2011 | timeline | timeline      |
single | 46 |       | Tue Nov 22 03:15:01 2011 | timeline | timeline      |
single | 47 |       | Tue Nov 22 04:15:02 2011 | timeline | timeline      |
single | 48 |       | Tue Nov 22 05:15:01 2011 | timeline | timeline      |
single | 49 |       | Tue Nov 22 06:15:01 2011 | timeline | timeline      |
pre    | 50 |       | Tue Nov 22 07:12:35 2011 | number   | zypp(zypper)  |
post   | 51 | 50    | Tue Nov 22 07:12:41 2011 | number   |               |
single | 52 |       | Tue Nov 22 07:15:02 2011 | timeline | timeline      |

these are the snapshots my system has done since i installed it for the former post. Here you can find the timeline snapshots which seems to run hourly.
The nicest feature is that openSUSE does snapshots before and after you do changes to the system via yast or via zypper. These snapshots like
pre    | 1  |       | Sun Nov 20 18:09:05 2011 | number   | yast firewall |
post   | 2  | 1     | Sun Nov 20 18:09:21 2011 | number   |               |

consists of two snapshots. One is taken before the change and one after these snapshot above should be the changes i made to the firewall to open the ports for ssh. but we can find out
snapper diff 1..2

--- /.snapshots/1/snapshot/etc/sysconfig/SuSEfirewall2  2011-11-20 18:05:29.957000000 +0100
+++ /.snapshots/2/snapshot/etc/sysconfig/SuSEfirewall2  2011-11-20 18:09:20.133078475 +0100
@@ -318,7 +318,7 @@
 # FW_SERVICES_ACCEPT_*
 #
 # Example: "samba-server nfs-kernel-server"
-FW_CONFIGURATIONS_EXT=""
+FW_CONFIGURATIONS_EXT="sshd"

 ## Type:       string
 #

So, yes, i opened the firewall :-)
Now we could do a
snapper undochange 1..2 /etc/sysconfig/SuSEfirewall2

to just revert the change of the file. To gain a bit more overview on snapper you should take a look on snapper help which provides all the information you could need.

 

Have a lot of fun