Last active
March 27, 2021 13:31
-
-
Save valorad/fd306db9b7807ff12caa504e39bf3ae9 to your computer and use it in GitHub Desktop.
Mount BTRFS volumes and make a read-only system volume BTRFS snapshot on backup volume
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
# Snapshot @targetSubvolume to @storageSubvolume/path/to/checkpoints/folder | |
UUID='76186cef-780f-4a80-9c0f-19fcc3a53ee6' | |
targetSubvolumeName='@arch-root' | |
storageSubvolumeName='@workspace' | |
mountPath="/mnt/$UUID" | |
systemVolumePath="$mountPath/$targetSubvolumeName" | |
snapshotPath="$mountPath/$storageSubvolumeName/systemCenter/btrfs/checkpoints/" | |
mkdir -p $mountPath | |
mount --uuid $UUID $mountPath | |
mkdir -p $snapshotPath | |
btrfs subvol snapshot -r $systemVolumePath $snapshotPath/@arch-checkpoint-"$(date '+%Y%m%d-%s')"-RO | |
umount -R $mountPath | |
rm -R $mountPath |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment