sudo snap install snapcraft --classic
sudo snap install lxd
sudo apt update
sudo apt install -y git
cd ~/
git clone https://github.com/ernestl/snapshot-exclude-demo.git
cd ~/snapshot-exclude-demo
snapcraft --use-lxd --debug
sudo snap install snapshot-exclude-demo_0.1_amd64.snap --devmode --dangerous
ⓘ This snap uses devmode confinement as specified in
snapcraft.yaml
top-level metadata
unsquashfs -f snapshot-exclude-demo_0.1_amd64.snap
tree squashfs-root
This shows the optional metadata file snapshots.yaml
installed into the snap meta directory:
squashfs-root
├── bin
│ ├── bash.sh
│ ├── create-system-data.sh
│ └── create-user-data.sh
└── meta
├── gui
├── snapshots.yaml
└── snap.yaml
snapshot-exclude-demo.bash
and exit
exit
sudo snapshot-exclude-demo.create-system-data
This creates the following system data in /var/snap/snapshot-exclude-demo/
:
├── common
│ └── generic
│ └── file.dat
├── current -> x1
└── x1
├── excl-1
│ └── file.log
├── excl-2
│ └── file.log
└── state-info
└── state.dat
snapshot-exclude-demo.create-user-data
This creates the following user data in ~/snap/snapshot-exclude-demo/
:
├── common
│ ├── generic
│ │ └── file.dat
│ └── tmp
│ └── file.tmp
├── current -> x1
└── x1
└── large-files
├── large-file-not-used.bin
├── large-file-not-used.dat
└── large-file-used.bin
snap save snapshot-exclude-demo
ⓘ Take note of the set ID provided on completion of the
snap save
command
snap restore <set ID>
This restores the system data that was not excluded from the snapshot in /var/snap/snapshot-exclude-demo/
:
├── common
│ └── generic
│ └── file.dat
├── current -> x1
└── x1
└── state-info
└── state.dat
as well as the user data that was not excluded from the snapshot in ~/snap/snapshot-exclude-demo/
:
├── common
│ └── generic
│ └── file.dat
├── current -> x1
└── x1
└── large-files
└── large-file-used.bin