SlideShare a Scribd company logo
1 of 40
Download to read offline
Full System Rollback 
using 
Btrfs and Snapper 
Matthias G. Eckermann 
Senior Product Manager 
mge@suse.com 
LinuxCon Europe 2014 
2014-10-05 12:00 UTC
Why?
3 
RAS 
System 
Rollback 
High Availability Live Kernel 
Patching 
Increase Uptime
4 
RAS 
High Availability Live Kernel 
Patching 
Increase Uptime 
System 
Rollback
5 
System Rollback 
Reduce Operational Downtime 
Goal 
Go back to well-known system state 
Peace of mind for 
• System administrative tasks 
• Package and patch installation 
• System upgrades
Introducing “snapper”
7 
http://www.snapper.io/
8 
Demonstration #1 
Using Snapshots with YaST2 snapper 
# Description Tools 
1 Track and visualize YaST 
activities with snapper 
Start YaST2 
Create a new user (yast users) 
Start YaST snapper 
View the changes 
2 Undo some of the changes Start YaST snapper 
Select the snapshot pair created 
by the “yast users” module 
3 Install a new package by either 
using YaST2 and visualize the 
result using YaST2 snapper 
YaST2
9 
Snapper Functionality 
• Manage snapshots 
‒ Automatically create snapshots 
‒ Display differences between snapshots 
‒ Roll-back 
• Integration into system / systems management stack 
‒ ZYpp, YUM, (apt?) 
‒ LinuxPAM 
• User Interfaces 
‒ CLI 
‒ DBUS 
‒ Graphical (YaST) 
‒ GUI integration (in development / GSoC)
10 
Introducing “Snapper” – CLI example 
Snapper headers: 
– Type : [ Pre | Post | Single ] 
– # : Nr of snapshot 
– Pre # : if type is “Post” the matching Pre nr. 
– Date : timestamp 
– Cleanup : cleanup algorithm for this snapshot 
– Description : A fitting description of the snapshot (free 
text) 
– Userdata : key=value pairs to record all sorts of useful 
information about the snapshot in an easily 
parsable format
11 
Demonstration#3 
Snapper Command Line 
# Description Tools 
1 List the currently available snapshots “snapper list ...” 
2 Show differensce in the snapshot 
pair created by “yast users” 
“snapper status ...” 
3 Show the difference only in 
/etc/shadow in the snapshot pair 
created by “yast users” 
“snapper diff ...” 
4 Undo a change remove unnecessary files in the user's home dir; 
then execute “snapper undochange ...” 
5 Create your own snapshot and 
modify its description 
“snapper create … -d <description>” 
“snapper modify … <num>” 
6 Add key-value pair to existing 
snapshot 
“snapper modify … --userdata … <num>” 
7 Create your own snapshot pair “snapper create –print-number --type pre ...” 
“snapper create --type post --pre-number <n1>...” 
8 Change description and user data “snapper modify … <num>” 
9 Rollback the full system “snapper rollback … <num> | current”
12 
Special Use case: Snapper and ITIL 
# @Begin of implementation Change: 
snapper create  
--type pre  
--description "ChgMgt Work order: Upgrade syslog 
configuration to forward log entries to central log 
server"  
--userdata  
"WorkOrder=201201253030000012-1, 
State=InProgress,Agent=jdoe@example.com" 
# @End of implementation Change: 
snapper create  
--type post --pre-number 240  
--description "Done: ChgMgt Work order: Upgrade syslog 
configuration to forward log entries to central log 
server"  
--userdata "WorkOrder=201201253030000012-1, 
State=Closed, Agent=jdoe@example.com"
Rollback
14 
File based Rollback 
How it works 
• The system uses the same instance of a subvolume: 
“working instance” 
• single files are copied from the snapshot to the “working 
instance” – using CoW 
Benefits 
• Subvolumes are treated as read-only 
• Subvolumes can be used for Backup 
• Supports Pick and Choose 
Disadvantages 
• rollback not “atomic” 
→ Implemented in Snapper as “undochange”
15 
Rollback per Subvolume 
How it works 
• Instead of the original subvolume, the snapshot is mounted 
with the options “subvol=<name>” 
‒ Remember: snapshots are subvolumes 
• “btrfs subvolume set-default ...” for permanent assignments 
Benefits 
• “atomic” operation 
• Very fast 
Disadvantages 
• Additional complexity 
‒ Require explicit mounting of subvolumes 
• No “rollback” per single file → “Full System Rollback” 
→ Implemented in Snapper as “rollback”
16 
Snapshot/Rollback – Overview 
Past & Present Present & Future 
• “snapper undochange” 
• Selective Rollback for 
‒ Package updates 
‒ Administrative changes 
• No rollback of 
‒ Kernel / initrd 
‒ Bootloader 
‒ System data, e.g. /var/log 
• “snapper rollback” 
• Full Rollback for 
‒ Package updates 
‒ Administrative changes 
‒ Kernel / initrd (initramfs) 
• No rollback of 
‒ Bootloader 
‒ Customer data: “/home”, if 
on own partition (default) 
‒ System data, e.g. /var/log 
High Demand
17 
Snapshotting “/” – Challenges 
• Kernel and initrd / initramfs = “/boot” 
‒ Grub2 booting from a snapshot = subvolume 
‒ Mark snapshots with /boot relevance as such 
• System integrity and Compliance 
‒ Don't allow to roll back certain log-files etc. 
‒ Solution: subvolumes instead of directories for 
/tmp 
/opt 
/srv 
/var/spool 
/var/log 
/var/run 
/var/tmp 
...
18 
Btrfs integration with ... 
• Installer 
‒ Btrfs as root fs 
‒ Recommendation for subvolume layout 
‒ Check size of root partition 
‒ Automated snapper configuration 
• Partitioner 
‒ Create Btrfs 
‒ Create subvolumes 
• Bootloader 
‒ Find existing subvolumes (snapshots) 
‒ Read existing subvolumes and boot from
Full System Rollback
20 
Full System Rollback – Use Cases 
• “I have changed something, the system is still 
working, but now some functionality is missing / 
performance is bad / ...” 
→ reset the system, reboot, enjoy! 
→ “Reboot later mode” 
• “Something changed, and the system is not booting 
anymore” (worst case scenario) 
→ need immediate reboot 
→ “Reboot now mode”
21 
Snapshot / Rollback 
Reboot Later Mode 
• Administrator is in a current read-write filesystem, 
but wants to rollback 
• “snapper list” to view and select a snapshot 
• Call 
“snapper rollback <number>” 
this will 
● Create a new read-only snapshot of the currently running system 
● Create a new read-write snapshot of the snapshot <number>, 
lineary after the just recently created read-only snapshot 
● “setdefault” to the new read-write snapshot 
and reboot
22 
Snapshot / Rollback 
Reboot Now Mode 
• Boot into an existing read-only snapshot 
• The system should work, as all variable data are on 
writable subvolumes anyways. 
• To continue to work in this snapshot, the admin 
should call 
“snapper rollback” 
– this will 
● Create a new read-only snapshot of the old read-write one, linearly 
after the last existing one 
● Create a new read-write snapshot of the snapshot you are currently 
in in read-only mode, lineary after the just recently created read-only 
snapshot 
● “setdefault” to the new read-write snapshot 
and reboot
User view on Snapshot History
24 
Snapshot / Rollback 
User view on Snapshot History (1) 
ro ro ro ro curr. 
rw
25 
Snapshot / Rollback 
User view on Snapshot History (2) 
ro ro ro ro 
curr. 
rw ro 
1 
ro-Clone
26 
Snapshot / Rollback 
User view on Snapshot History (3) 
btrfs subvol 
set-default 
2 3 
old 
rw ro 
ro ro ro new 
ro rw 
1 
ro-Clone 
rw-Clone = Rollback
27 
Snapshot / Rollback 
User view on Snapshot History (4) 
New Snapshots 
ro ro ro 3 new 
ro 4 rw old 
rw ro 5 4 
Diffs are possible 
ro 6
28 
Snapshot / Rollback 
User view on Snapshot History (5) 
Condensed view What happens, 
if we rollback again? 
ro 3 ro 4 ro 5 ro 6 
rw 
Caveat: this does not reflect 1:1 what happens technically.
29 
Demonstration#4 
Full System Rollback 
# Description Tools 
1 List the currently available snapshots “snapper list” 
2 Install a new kernel “zypper in ...” 
3 List the currently available snapshots “snapper list” 
4 Show the current kernel version and reboot “uname -a ; reboot” 
5 List the currently available snapshots “snapper list” 
6 Rollback to the former version and reboot “snapper rollback <num> ; reboot” 
7 List the currently available snapshots “snapper list” 
8 Show the current kernel version “uname -a”
Summary
31 
“Snapper” availability ... 
http://software.opensuse.org/download/package?project=filesystems:snapper&package=snapper
32 
System Rollback 
Reduce Operational Downtime 
Goal 
Go back to well-known system state 
Peace of mind for 
• System administrative tasks 
• Package and patch installation 
• System upgrades
Thank you. 
33 
Go ahead, try btrfs and snapper 
today! 
Your questions!?
Appendix
Demo “scripts”
36 
Demonstration#2 
btrfs subvols and snapshots 
# Description Tools 
1 List the currently available 
subvolumes 
“btrfs subvol ...” 
2 List the currently available 
subvolumes – display details about 
the “parents” of the subvolumes 
“btrfs subvol … -p ...” 
3 Create your own subvolume 
“/mydata” 
“btrfs subvol ...”
37 
Demonstration#5 
Migrating from ext3 to btrfs 
# Description Tools 
1 Create a logical volume or partition or loop 
device. Name it “toconvert” or the like. 
2 Create an ext3 filesystem on this “toconvert” and 
mount it to “/toconvert” 
“mkfs.ext3 -b 4096 ...” 
“mkdir”, “mount” 
3 Create some directories and files on “/toconvert”. 
Optional: create md5 checksums 
“mkdir”, “vi” 
Optional: “md5sum” 
4 Perform the conversion and mount the filesystem 
again 
“umount /toconvert” 
“btrfs-convert ... 
“mount ...” 
5 Control, if your data are all there and check the 
optional md5sums 
“find”, “md5sum”, ... 
6 Understand, how btrfs saves the old ext3 
filesystem metadata. 
“/toconvert/ext2_saved/image” 
“mount -o loop ...”
38 
Demonstration#6 
Using snapper for /home/$USER 
Requirements 
• /home/$USER is a btrfs subvolume 
• “snapper” with DBUS interface (SLES 11 SP3, 
openSUSE 12.3, ...) 
• Create a snapper configuration for the user allowing 
him/her to do snapshots 
Additional Option 
• Automated snapshotting on login/logout 
• Requires small changes to the configuration of Linux 
PAM (Pluggable Configuration Modules)
Corporate Headquarters 
Maxfeldstrasse 5 
90409 Nuremberg 
Germany 
+49 911 740 53 0 (Worldwide) 
www.suse.com 
Join us on: 
www.opensuse.org 
39
Unpublished Work of SUSE. All Rights Reserved. 
This work is an unpublished work and contains confidential, proprietary and trade secret information of SUSE. 
Access to this work is restricted to SUSE employees who have a need to know to perform tasks within the scope of 
their assignments. No part of this work may be practiced, performed, copied, distributed, revised, modified, translated, 
abridged, condensed, expanded, collected, or adapted without the prior written consent of SUSE. 
Any use or exploitation of this work without authorization could subject the perpetrator to criminal and civil liability. 
General Disclaimer 
This document is not to be construed as a promise by any participating company to develop, deliver, or market a 
product. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making 
purchasing decisions. SUSE makes no representations or warranties with respect to the contents of this document, 
and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. The 
development, release, and timing of features or functionality described for SUSE products remains at the sole 
discretion of SUSE. Further, SUSE reserves the right to revise this document and to make changes to its content, at 
any time, without obligation to notify any person or entity of such revisions or changes. All SUSE marks referenced in 
this presentation are trademarks or registered trademarks of Novell, Inc. in the United States and other countries. All 
third-party trademarks are the property of their respective owners.

More Related Content

What's hot

EuroBSDcon 2017 System Performance Analysis Methodologies
EuroBSDcon 2017 System Performance Analysis MethodologiesEuroBSDcon 2017 System Performance Analysis Methodologies
EuroBSDcon 2017 System Performance Analysis Methodologies
Brendan Gregg
 

What's hot (20)

Kernel Configuration and Compilation
Kernel Configuration and CompilationKernel Configuration and Compilation
Kernel Configuration and Compilation
 
Effective service and resource management with systemd
Effective service and resource management with systemdEffective service and resource management with systemd
Effective service and resource management with systemd
 
제4회 한국IBM과 함께하는 난공불락 오픈소스 인프라 세미나-Asible
제4회 한국IBM과 함께하는 난공불락 오픈소스 인프라 세미나-Asible제4회 한국IBM과 함께하는 난공불락 오픈소스 인프라 세미나-Asible
제4회 한국IBM과 함께하는 난공불락 오픈소스 인프라 세미나-Asible
 
SystemV vs systemd
SystemV vs systemdSystemV vs systemd
SystemV vs systemd
 
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all started
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all startedKernel Recipes 2019 - ftrace: Where modifying a running kernel all started
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all started
 
LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager
 
Pdf c1t tlawaxb
Pdf c1t tlawaxbPdf c1t tlawaxb
Pdf c1t tlawaxb
 
Make Your Containers Faster: Linux Container Performance Tools
Make Your Containers Faster: Linux Container Performance ToolsMake Your Containers Faster: Linux Container Performance Tools
Make Your Containers Faster: Linux Container Performance Tools
 
Full system roll-back and systemd in SUSE Linux Enterprise 12
Full system roll-back and systemd in SUSE Linux Enterprise 12Full system roll-back and systemd in SUSE Linux Enterprise 12
Full system roll-back and systemd in SUSE Linux Enterprise 12
 
제3회난공불락 오픈소스 인프라세미나 - lustre
제3회난공불락 오픈소스 인프라세미나 - lustre제3회난공불락 오픈소스 인프라세미나 - lustre
제3회난공불락 오픈소스 인프라세미나 - lustre
 
Linux Kernel Init Process
Linux Kernel Init ProcessLinux Kernel Init Process
Linux Kernel Init Process
 
Xen in Linux 3.x (or PVOPS)
Xen in Linux 3.x (or PVOPS)Xen in Linux 3.x (or PVOPS)
Xen in Linux 3.x (or PVOPS)
 
CLUG 2010 09 - systemd - the new init system
CLUG 2010 09 - systemd - the new init systemCLUG 2010 09 - systemd - the new init system
CLUG 2010 09 - systemd - the new init system
 
Linux Containers From Scratch
Linux Containers From ScratchLinux Containers From Scratch
Linux Containers From Scratch
 
Systemd cheatsheet
Systemd cheatsheetSystemd cheatsheet
Systemd cheatsheet
 
EuroBSDcon 2017 System Performance Analysis Methodologies
EuroBSDcon 2017 System Performance Analysis MethodologiesEuroBSDcon 2017 System Performance Analysis Methodologies
EuroBSDcon 2017 System Performance Analysis Methodologies
 
Kernel Recipes 2015 - Porting Linux to a new processor architecture
Kernel Recipes 2015 - Porting Linux to a new processor architectureKernel Recipes 2015 - Porting Linux to a new processor architecture
Kernel Recipes 2015 - Porting Linux to a new processor architecture
 
Systemd mlug-20140614
Systemd mlug-20140614Systemd mlug-20140614
Systemd mlug-20140614
 
Systemd for developers
Systemd for developersSystemd for developers
Systemd for developers
 
Linux Containers From Scratch: Makfile MicroVPS
Linux Containers From Scratch: Makfile MicroVPSLinux Containers From Scratch: Makfile MicroVPS
Linux Containers From Scratch: Makfile MicroVPS
 

Viewers also liked (7)

Openstack v4 0
Openstack v4 0Openstack v4 0
Openstack v4 0
 
Gluster fs guide(v1.0)
Gluster fs guide(v1.0)Gluster fs guide(v1.0)
Gluster fs guide(v1.0)
 
난공불락세미나 Ldap
난공불락세미나 Ldap난공불락세미나 Ldap
난공불락세미나 Ldap
 
Lkda facebook seminar_140419
Lkda facebook seminar_140419Lkda facebook seminar_140419
Lkda facebook seminar_140419
 
Hardware accelerated virtio networking for nfv linux con
Hardware accelerated virtio networking for nfv linux conHardware accelerated virtio networking for nfv linux con
Hardware accelerated virtio networking for nfv linux con
 
Linux con europe_2014_full_system_rollback_btrfs_snapper_0
Linux con europe_2014_full_system_rollback_btrfs_snapper_0Linux con europe_2014_full_system_rollback_btrfs_snapper_0
Linux con europe_2014_full_system_rollback_btrfs_snapper_0
 
다른 회사는 어떻게 QA, 테스팅을 하고 있을까? (google, facebook, atlass...
다른 회사는 어떻게 QA, 테스팅을 하고 있을까? (google, facebook, atlass...다른 회사는 어떻게 QA, 테스팅을 하고 있을까? (google, facebook, atlass...
다른 회사는 어떻게 QA, 테스팅을 하고 있을까? (google, facebook, atlass...
 

Similar to Linux con europe_2014_f

SnapVault SE presentation
SnapVault SE presentationSnapVault SE presentation
SnapVault SE presentation
Robbie Rikard
 
Bews command line_en
Bews command line_enBews command line_en
Bews command line_en
Om Pal
 
kubernetes - minikube - getting started
kubernetes - minikube - getting startedkubernetes - minikube - getting started
kubernetes - minikube - getting started
Munish Mehta
 
Monitoring_with_Prometheus_Grafana_Tutorial
Monitoring_with_Prometheus_Grafana_TutorialMonitoring_with_Prometheus_Grafana_Tutorial
Monitoring_with_Prometheus_Grafana_Tutorial
Tim Vaillancourt
 

Similar to Linux con europe_2014_f (20)

Monitoring at/with SUSE 2015
Monitoring at/with SUSE 2015Monitoring at/with SUSE 2015
Monitoring at/with SUSE 2015
 
hacking-embedded-devices.pptx
hacking-embedded-devices.pptxhacking-embedded-devices.pptx
hacking-embedded-devices.pptx
 
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!
 
Python Control library
Python Control libraryPython Control library
Python Control library
 
Linux Kernel Live Patching
Linux Kernel Live PatchingLinux Kernel Live Patching
Linux Kernel Live Patching
 
Training Slides: 203 - Backup & Recovery
Training Slides: 203 - Backup & RecoveryTraining Slides: 203 - Backup & Recovery
Training Slides: 203 - Backup & Recovery
 
SnapVault SE presentation
SnapVault SE presentationSnapVault SE presentation
SnapVault SE presentation
 
Bews command line_en
Bews command line_enBews command line_en
Bews command line_en
 
systemd @ Facebook -- a year later
systemd @ Facebook -- a year latersystemd @ Facebook -- a year later
systemd @ Facebook -- a year later
 
kubernetes - minikube - getting started
kubernetes - minikube - getting startedkubernetes - minikube - getting started
kubernetes - minikube - getting started
 
Kubernetes Walk Through from Technical View
Kubernetes Walk Through from Technical ViewKubernetes Walk Through from Technical View
Kubernetes Walk Through from Technical View
 
OpenNebulaConf 2016 - Storage Hands-on Workshop by Javier Fontán, OpenNebula
OpenNebulaConf 2016 - Storage Hands-on Workshop by Javier Fontán, OpenNebulaOpenNebulaConf 2016 - Storage Hands-on Workshop by Javier Fontán, OpenNebula
OpenNebulaConf 2016 - Storage Hands-on Workshop by Javier Fontán, OpenNebula
 
Kernel Recipes 2015 - Kernel dump analysis
Kernel Recipes 2015 - Kernel dump analysisKernel Recipes 2015 - Kernel dump analysis
Kernel Recipes 2015 - Kernel dump analysis
 
Training Slides: Basics 102: Introduction to Tungsten Clustering
Training Slides: Basics 102: Introduction to Tungsten ClusteringTraining Slides: Basics 102: Introduction to Tungsten Clustering
Training Slides: Basics 102: Introduction to Tungsten Clustering
 
Monitoring_with_Prometheus_Grafana_Tutorial
Monitoring_with_Prometheus_Grafana_TutorialMonitoring_with_Prometheus_Grafana_Tutorial
Monitoring_with_Prometheus_Grafana_Tutorial
 
Linux Server Deep Dives (DrupalCon Amsterdam)
Linux Server Deep Dives (DrupalCon Amsterdam)Linux Server Deep Dives (DrupalCon Amsterdam)
Linux Server Deep Dives (DrupalCon Amsterdam)
 
Docker 原理與實作
Docker 原理與實作Docker 原理與實作
Docker 原理與實作
 
Docker, Monitoring and SLURM Specific Visualisations
Docker, Monitoring and SLURM Specific VisualisationsDocker, Monitoring and SLURM Specific Visualisations
Docker, Monitoring and SLURM Specific Visualisations
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache Kafka
 
Kdump
KdumpKdump
Kdump
 

More from sprdd

Glusterfs 소개 v1.0_난공불락세미나
Glusterfs 소개 v1.0_난공불락세미나Glusterfs 소개 v1.0_난공불락세미나
Glusterfs 소개 v1.0_난공불락세미나
sprdd
 
Zinst 패키지 기반의-리눅스_중앙관리시스템_20140415
Zinst 패키지 기반의-리눅스_중앙관리시스템_20140415Zinst 패키지 기반의-리눅스_중앙관리시스템_20140415
Zinst 패키지 기반의-리눅스_중앙관리시스템_20140415
sprdd
 
Summit2014 riel chegu_w_0340_automatic_numa_balancing_0
Summit2014 riel chegu_w_0340_automatic_numa_balancing_0Summit2014 riel chegu_w_0340_automatic_numa_balancing_0
Summit2014 riel chegu_w_0340_automatic_numa_balancing_0
sprdd
 
오픈소스컨설팅 클러스터제안 V1.0
오픈소스컨설팅 클러스터제안 V1.0오픈소스컨설팅 클러스터제안 V1.0
오픈소스컨설팅 클러스터제안 V1.0
sprdd
 
HP NMI WATCHDOG
HP NMI WATCHDOGHP NMI WATCHDOG
HP NMI WATCHDOG
sprdd
 
H2890 emc-clariion-asymm-active-wp
H2890 emc-clariion-asymm-active-wpH2890 emc-clariion-asymm-active-wp
H2890 emc-clariion-asymm-active-wp
sprdd
 
Cluster pitfalls recommand
Cluster pitfalls recommandCluster pitfalls recommand
Cluster pitfalls recommand
sprdd
 
Wheeler w 0450_linux_file_systems1
Wheeler w 0450_linux_file_systems1Wheeler w 0450_linux_file_systems1
Wheeler w 0450_linux_file_systems1
sprdd
 
Wheeler w 0450_linux_file_systems1
Wheeler w 0450_linux_file_systems1Wheeler w 0450_linux_file_systems1
Wheeler w 0450_linux_file_systems1
sprdd
 
2013fooscoverpageimage 130417105210-phpapp01
2013fooscoverpageimage 130417105210-phpapp012013fooscoverpageimage 130417105210-phpapp01
2013fooscoverpageimage 130417105210-phpapp01
sprdd
 
Openstackinsideoutv10 140222065532-phpapp01
Openstackinsideoutv10 140222065532-phpapp01Openstackinsideoutv10 140222065532-phpapp01
Openstackinsideoutv10 140222065532-phpapp01
sprdd
 
Rhel cluster gfs_improveperformance
Rhel cluster gfs_improveperformanceRhel cluster gfs_improveperformance
Rhel cluster gfs_improveperformance
sprdd
 
Doldoggi bisiri
Doldoggi bisiriDoldoggi bisiri
Doldoggi bisiri
sprdd
 
유닉스 리눅스 마이그레이션_이호성_v1.0
유닉스 리눅스 마이그레이션_이호성_v1.0유닉스 리눅스 마이그레이션_이호성_v1.0
유닉스 리눅스 마이그레이션_이호성_v1.0
sprdd
 
세미나설문
세미나설문세미나설문
세미나설문
sprdd
 
5231 140-hellwig
5231 140-hellwig5231 140-hellwig
5231 140-hellwig
sprdd
 
Glusterfs 파일시스템 구성_및 운영가이드_v2.0
Glusterfs 파일시스템 구성_및 운영가이드_v2.0Glusterfs 파일시스템 구성_및 운영가이드_v2.0
Glusterfs 파일시스템 구성_및 운영가이드_v2.0
sprdd
 
Glusterfs 구성제안 및_운영가이드_v2.0
Glusterfs 구성제안 및_운영가이드_v2.0Glusterfs 구성제안 및_운영가이드_v2.0
Glusterfs 구성제안 및_운영가이드_v2.0
sprdd
 
Glusterfs 구성제안서 v1.0
Glusterfs 구성제안서 v1.0Glusterfs 구성제안서 v1.0
Glusterfs 구성제안서 v1.0
sprdd
 
Glusterfs 구성제안 v1.0
Glusterfs 구성제안 v1.0Glusterfs 구성제안 v1.0
Glusterfs 구성제안 v1.0
sprdd
 

More from sprdd (20)

Glusterfs 소개 v1.0_난공불락세미나
Glusterfs 소개 v1.0_난공불락세미나Glusterfs 소개 v1.0_난공불락세미나
Glusterfs 소개 v1.0_난공불락세미나
 
Zinst 패키지 기반의-리눅스_중앙관리시스템_20140415
Zinst 패키지 기반의-리눅스_중앙관리시스템_20140415Zinst 패키지 기반의-리눅스_중앙관리시스템_20140415
Zinst 패키지 기반의-리눅스_중앙관리시스템_20140415
 
Summit2014 riel chegu_w_0340_automatic_numa_balancing_0
Summit2014 riel chegu_w_0340_automatic_numa_balancing_0Summit2014 riel chegu_w_0340_automatic_numa_balancing_0
Summit2014 riel chegu_w_0340_automatic_numa_balancing_0
 
오픈소스컨설팅 클러스터제안 V1.0
오픈소스컨설팅 클러스터제안 V1.0오픈소스컨설팅 클러스터제안 V1.0
오픈소스컨설팅 클러스터제안 V1.0
 
HP NMI WATCHDOG
HP NMI WATCHDOGHP NMI WATCHDOG
HP NMI WATCHDOG
 
H2890 emc-clariion-asymm-active-wp
H2890 emc-clariion-asymm-active-wpH2890 emc-clariion-asymm-active-wp
H2890 emc-clariion-asymm-active-wp
 
Cluster pitfalls recommand
Cluster pitfalls recommandCluster pitfalls recommand
Cluster pitfalls recommand
 
Wheeler w 0450_linux_file_systems1
Wheeler w 0450_linux_file_systems1Wheeler w 0450_linux_file_systems1
Wheeler w 0450_linux_file_systems1
 
Wheeler w 0450_linux_file_systems1
Wheeler w 0450_linux_file_systems1Wheeler w 0450_linux_file_systems1
Wheeler w 0450_linux_file_systems1
 
2013fooscoverpageimage 130417105210-phpapp01
2013fooscoverpageimage 130417105210-phpapp012013fooscoverpageimage 130417105210-phpapp01
2013fooscoverpageimage 130417105210-phpapp01
 
Openstackinsideoutv10 140222065532-phpapp01
Openstackinsideoutv10 140222065532-phpapp01Openstackinsideoutv10 140222065532-phpapp01
Openstackinsideoutv10 140222065532-phpapp01
 
Rhel cluster gfs_improveperformance
Rhel cluster gfs_improveperformanceRhel cluster gfs_improveperformance
Rhel cluster gfs_improveperformance
 
Doldoggi bisiri
Doldoggi bisiriDoldoggi bisiri
Doldoggi bisiri
 
유닉스 리눅스 마이그레이션_이호성_v1.0
유닉스 리눅스 마이그레이션_이호성_v1.0유닉스 리눅스 마이그레이션_이호성_v1.0
유닉스 리눅스 마이그레이션_이호성_v1.0
 
세미나설문
세미나설문세미나설문
세미나설문
 
5231 140-hellwig
5231 140-hellwig5231 140-hellwig
5231 140-hellwig
 
Glusterfs 파일시스템 구성_및 운영가이드_v2.0
Glusterfs 파일시스템 구성_및 운영가이드_v2.0Glusterfs 파일시스템 구성_및 운영가이드_v2.0
Glusterfs 파일시스템 구성_및 운영가이드_v2.0
 
Glusterfs 구성제안 및_운영가이드_v2.0
Glusterfs 구성제안 및_운영가이드_v2.0Glusterfs 구성제안 및_운영가이드_v2.0
Glusterfs 구성제안 및_운영가이드_v2.0
 
Glusterfs 구성제안서 v1.0
Glusterfs 구성제안서 v1.0Glusterfs 구성제안서 v1.0
Glusterfs 구성제안서 v1.0
 
Glusterfs 구성제안 v1.0
Glusterfs 구성제안 v1.0Glusterfs 구성제안 v1.0
Glusterfs 구성제안 v1.0
 

Linux con europe_2014_f

  • 1. Full System Rollback using Btrfs and Snapper Matthias G. Eckermann Senior Product Manager mge@suse.com LinuxCon Europe 2014 2014-10-05 12:00 UTC
  • 3. 3 RAS System Rollback High Availability Live Kernel Patching Increase Uptime
  • 4. 4 RAS High Availability Live Kernel Patching Increase Uptime System Rollback
  • 5. 5 System Rollback Reduce Operational Downtime Goal Go back to well-known system state Peace of mind for • System administrative tasks • Package and patch installation • System upgrades
  • 8. 8 Demonstration #1 Using Snapshots with YaST2 snapper # Description Tools 1 Track and visualize YaST activities with snapper Start YaST2 Create a new user (yast users) Start YaST snapper View the changes 2 Undo some of the changes Start YaST snapper Select the snapshot pair created by the “yast users” module 3 Install a new package by either using YaST2 and visualize the result using YaST2 snapper YaST2
  • 9. 9 Snapper Functionality • Manage snapshots ‒ Automatically create snapshots ‒ Display differences between snapshots ‒ Roll-back • Integration into system / systems management stack ‒ ZYpp, YUM, (apt?) ‒ LinuxPAM • User Interfaces ‒ CLI ‒ DBUS ‒ Graphical (YaST) ‒ GUI integration (in development / GSoC)
  • 10. 10 Introducing “Snapper” – CLI example Snapper headers: – Type : [ Pre | Post | Single ] – # : Nr of snapshot – Pre # : if type is “Post” the matching Pre nr. – Date : timestamp – Cleanup : cleanup algorithm for this snapshot – Description : A fitting description of the snapshot (free text) – Userdata : key=value pairs to record all sorts of useful information about the snapshot in an easily parsable format
  • 11. 11 Demonstration#3 Snapper Command Line # Description Tools 1 List the currently available snapshots “snapper list ...” 2 Show differensce in the snapshot pair created by “yast users” “snapper status ...” 3 Show the difference only in /etc/shadow in the snapshot pair created by “yast users” “snapper diff ...” 4 Undo a change remove unnecessary files in the user's home dir; then execute “snapper undochange ...” 5 Create your own snapshot and modify its description “snapper create … -d <description>” “snapper modify … <num>” 6 Add key-value pair to existing snapshot “snapper modify … --userdata … <num>” 7 Create your own snapshot pair “snapper create –print-number --type pre ...” “snapper create --type post --pre-number <n1>...” 8 Change description and user data “snapper modify … <num>” 9 Rollback the full system “snapper rollback … <num> | current”
  • 12. 12 Special Use case: Snapper and ITIL # @Begin of implementation Change: snapper create --type pre --description "ChgMgt Work order: Upgrade syslog configuration to forward log entries to central log server" --userdata "WorkOrder=201201253030000012-1, State=InProgress,Agent=jdoe@example.com" # @End of implementation Change: snapper create --type post --pre-number 240 --description "Done: ChgMgt Work order: Upgrade syslog configuration to forward log entries to central log server" --userdata "WorkOrder=201201253030000012-1, State=Closed, Agent=jdoe@example.com"
  • 14. 14 File based Rollback How it works • The system uses the same instance of a subvolume: “working instance” • single files are copied from the snapshot to the “working instance” – using CoW Benefits • Subvolumes are treated as read-only • Subvolumes can be used for Backup • Supports Pick and Choose Disadvantages • rollback not “atomic” → Implemented in Snapper as “undochange”
  • 15. 15 Rollback per Subvolume How it works • Instead of the original subvolume, the snapshot is mounted with the options “subvol=<name>” ‒ Remember: snapshots are subvolumes • “btrfs subvolume set-default ...” for permanent assignments Benefits • “atomic” operation • Very fast Disadvantages • Additional complexity ‒ Require explicit mounting of subvolumes • No “rollback” per single file → “Full System Rollback” → Implemented in Snapper as “rollback”
  • 16. 16 Snapshot/Rollback – Overview Past & Present Present & Future • “snapper undochange” • Selective Rollback for ‒ Package updates ‒ Administrative changes • No rollback of ‒ Kernel / initrd ‒ Bootloader ‒ System data, e.g. /var/log • “snapper rollback” • Full Rollback for ‒ Package updates ‒ Administrative changes ‒ Kernel / initrd (initramfs) • No rollback of ‒ Bootloader ‒ Customer data: “/home”, if on own partition (default) ‒ System data, e.g. /var/log High Demand
  • 17. 17 Snapshotting “/” – Challenges • Kernel and initrd / initramfs = “/boot” ‒ Grub2 booting from a snapshot = subvolume ‒ Mark snapshots with /boot relevance as such • System integrity and Compliance ‒ Don't allow to roll back certain log-files etc. ‒ Solution: subvolumes instead of directories for /tmp /opt /srv /var/spool /var/log /var/run /var/tmp ...
  • 18. 18 Btrfs integration with ... • Installer ‒ Btrfs as root fs ‒ Recommendation for subvolume layout ‒ Check size of root partition ‒ Automated snapper configuration • Partitioner ‒ Create Btrfs ‒ Create subvolumes • Bootloader ‒ Find existing subvolumes (snapshots) ‒ Read existing subvolumes and boot from
  • 20. 20 Full System Rollback – Use Cases • “I have changed something, the system is still working, but now some functionality is missing / performance is bad / ...” → reset the system, reboot, enjoy! → “Reboot later mode” • “Something changed, and the system is not booting anymore” (worst case scenario) → need immediate reboot → “Reboot now mode”
  • 21. 21 Snapshot / Rollback Reboot Later Mode • Administrator is in a current read-write filesystem, but wants to rollback • “snapper list” to view and select a snapshot • Call “snapper rollback <number>” this will ● Create a new read-only snapshot of the currently running system ● Create a new read-write snapshot of the snapshot <number>, lineary after the just recently created read-only snapshot ● “setdefault” to the new read-write snapshot and reboot
  • 22. 22 Snapshot / Rollback Reboot Now Mode • Boot into an existing read-only snapshot • The system should work, as all variable data are on writable subvolumes anyways. • To continue to work in this snapshot, the admin should call “snapper rollback” – this will ● Create a new read-only snapshot of the old read-write one, linearly after the last existing one ● Create a new read-write snapshot of the snapshot you are currently in in read-only mode, lineary after the just recently created read-only snapshot ● “setdefault” to the new read-write snapshot and reboot
  • 23. User view on Snapshot History
  • 24. 24 Snapshot / Rollback User view on Snapshot History (1) ro ro ro ro curr. rw
  • 25. 25 Snapshot / Rollback User view on Snapshot History (2) ro ro ro ro curr. rw ro 1 ro-Clone
  • 26. 26 Snapshot / Rollback User view on Snapshot History (3) btrfs subvol set-default 2 3 old rw ro ro ro ro new ro rw 1 ro-Clone rw-Clone = Rollback
  • 27. 27 Snapshot / Rollback User view on Snapshot History (4) New Snapshots ro ro ro 3 new ro 4 rw old rw ro 5 4 Diffs are possible ro 6
  • 28. 28 Snapshot / Rollback User view on Snapshot History (5) Condensed view What happens, if we rollback again? ro 3 ro 4 ro 5 ro 6 rw Caveat: this does not reflect 1:1 what happens technically.
  • 29. 29 Demonstration#4 Full System Rollback # Description Tools 1 List the currently available snapshots “snapper list” 2 Install a new kernel “zypper in ...” 3 List the currently available snapshots “snapper list” 4 Show the current kernel version and reboot “uname -a ; reboot” 5 List the currently available snapshots “snapper list” 6 Rollback to the former version and reboot “snapper rollback <num> ; reboot” 7 List the currently available snapshots “snapper list” 8 Show the current kernel version “uname -a”
  • 31. 31 “Snapper” availability ... http://software.opensuse.org/download/package?project=filesystems:snapper&package=snapper
  • 32. 32 System Rollback Reduce Operational Downtime Goal Go back to well-known system state Peace of mind for • System administrative tasks • Package and patch installation • System upgrades
  • 33. Thank you. 33 Go ahead, try btrfs and snapper today! Your questions!?
  • 36. 36 Demonstration#2 btrfs subvols and snapshots # Description Tools 1 List the currently available subvolumes “btrfs subvol ...” 2 List the currently available subvolumes – display details about the “parents” of the subvolumes “btrfs subvol … -p ...” 3 Create your own subvolume “/mydata” “btrfs subvol ...”
  • 37. 37 Demonstration#5 Migrating from ext3 to btrfs # Description Tools 1 Create a logical volume or partition or loop device. Name it “toconvert” or the like. 2 Create an ext3 filesystem on this “toconvert” and mount it to “/toconvert” “mkfs.ext3 -b 4096 ...” “mkdir”, “mount” 3 Create some directories and files on “/toconvert”. Optional: create md5 checksums “mkdir”, “vi” Optional: “md5sum” 4 Perform the conversion and mount the filesystem again “umount /toconvert” “btrfs-convert ... “mount ...” 5 Control, if your data are all there and check the optional md5sums “find”, “md5sum”, ... 6 Understand, how btrfs saves the old ext3 filesystem metadata. “/toconvert/ext2_saved/image” “mount -o loop ...”
  • 38. 38 Demonstration#6 Using snapper for /home/$USER Requirements • /home/$USER is a btrfs subvolume • “snapper” with DBUS interface (SLES 11 SP3, openSUSE 12.3, ...) • Create a snapper configuration for the user allowing him/her to do snapshots Additional Option • Automated snapshotting on login/logout • Requires small changes to the configuration of Linux PAM (Pluggable Configuration Modules)
  • 39. Corporate Headquarters Maxfeldstrasse 5 90409 Nuremberg Germany +49 911 740 53 0 (Worldwide) www.suse.com Join us on: www.opensuse.org 39
  • 40. Unpublished Work of SUSE. All Rights Reserved. This work is an unpublished work and contains confidential, proprietary and trade secret information of SUSE. Access to this work is restricted to SUSE employees who have a need to know to perform tasks within the scope of their assignments. No part of this work may be practiced, performed, copied, distributed, revised, modified, translated, abridged, condensed, expanded, collected, or adapted without the prior written consent of SUSE. Any use or exploitation of this work without authorization could subject the perpetrator to criminal and civil liability. General Disclaimer This document is not to be construed as a promise by any participating company to develop, deliver, or market a product. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. SUSE makes no representations or warranties with respect to the contents of this document, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. The development, release, and timing of features or functionality described for SUSE products remains at the sole discretion of SUSE. Further, SUSE reserves the right to revise this document and to make changes to its content, at any time, without obligation to notify any person or entity of such revisions or changes. All SUSE marks referenced in this presentation are trademarks or registered trademarks of Novell, Inc. in the United States and other countries. All third-party trademarks are the property of their respective owners.