mirror of
https://github.com/garethgeorge/backrest.git
synced 2025-12-12 16:55:39 +00:00
docs: add btrfs snapshot sample to commands cookbook
This commit is contained in:
@@ -96,6 +96,35 @@ fi
|
||||
|
||||
**Error Behavior:** `ON_ERROR_CANCEL`
|
||||
|
||||
|
||||
#### Create a BTRFS filesystem snapshot before running a backup
|
||||
|
||||
Add a hook that creates a btrfs snapshot prior to each backup (overwriting any prior snapshot). This is useful for creating a point in time consistent copy of the filesystem for restic to read from. It eliminates the possibility of inconsistency due to the time it takes restic to scan your files during a backup.
|
||||
|
||||
**Condition** `CONDITION_SNAPSHOT_START`
|
||||
|
||||
**Script**
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
btrfs subvolume snapshot -r /your-btrfs-filesystem /your-btrfs-filesystem/.backrest-snapshot
|
||||
```
|
||||
|
||||
**Error Behavior:** `ON_ERROR_FATAL` (if the snapshot fails, the backup should fail)
|
||||
|
||||
Note: you may also add a hook to delete the snapshot after the backup is complete e.g.
|
||||
|
||||
**Condition** `CONDITION_SNAPSHOT_END`
|
||||
|
||||
**Script**
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
btrfs subvolume delete /your-btrfs-filesystem/.backrest-snapshot
|
||||
```
|
||||
|
||||
**Error Behavior:** `ON_ERROR_IGNORE` (even if the snapshot deletion fails, the backup was already successful)
|
||||
|
||||
#### Check that the battery is above a certain level
|
||||
|
||||
Add a hook to check that the battery is above a certain level before running a backup.
|
||||
|
||||
Reference in New Issue
Block a user