Skip to content

Instantly share code, notes, and snippets.

@ontheklaud
Created August 29, 2018 01:00
Show Gist options
  • Save ontheklaud/ea04480d139bf1d7d26726d112c2d14d to your computer and use it in GitHub Desktop.
Save ontheklaud/ea04480d139bf1d7d26726d112c2d14d to your computer and use it in GitHub Desktop.
Snapper (Filesystem Snapshot Helper) Installation for CentOS 7
#!/bin/bash
# Prerequisite:
# OS: CentOS 7.5.1804 installation with 'minimal install'
# Filesystem: LVM Thin-provisioning of root (/) with lvm(xfs).
# 0. enable EPEL-Release Repo
sudo yum -y install epel-release
# 1. install snapper (dependencies may follow)
sudo yum -y install snapper snapper-libs
# 2. SELinux (if active, otherwise goto 3)
# Snapper context (snapperd_t) must be permitted.
# You can also find SELinux AVC Denial log by 'grep -i snapper /var/log/audit/audit.log'
# You may install package 'policycoreutils-python' if not installed
# Reference: Learning RHEL Networking (Book), RedHat Bugzilla
# https://www.packtpub.com/mapt/book/networking_and_servers/9781785287831/5/ch05lvl1sec44/managing-snapshots-with-snapper
# https://books.google.co.kr/books?id=Sz0BCgAAQBAJ&pg=PA86&lpg=PA86&dq=snapper+permissive&source=bl
# https://bugzilla.redhat.com/show_bug.cgi?id=1514272
sudo semanage permissive -a snapperd_t
# 3. create root snapshot
# DISCLAIMER: I desire root filesystem snapshot. Use at own risk.
# If you experience 'Creating config failed (mkdir failed).', goto 2.
sudo snapper -c root create-config -f 'lvm(xfs)' /
# 4. check snapshots
sudo snapper ls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment