Skip to content

Commit

Permalink
Recommended layout: Correct and expand
Browse files Browse the repository at this point in the history
See issue #28.
  • Loading branch information
hirak99 committed Feb 18, 2024
1 parent 398e1a9 commit c5f9068
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,34 @@ Tips -
- Mount by `subvol=NAME`, instead of `subvolid=NUMERIC_ID`. This is necessary to allow rollbacks without touching the fstab.
- Create a top level subvolume for all snapshots.

To set this up in shell, mount the top volume and create a @.snapshot subvolume -
### Example Shell commands to set up

To set this up in shell, mount the top volume and create a @.snapshots subvolume -
```sh
# Mount the top level subvolume (id 5) into a temporary mount dir.
TOP=/run/mount/btrfs_top # Temporary path to mount subvol.
mkdir $TOP
mount /dev/sdX $TOP -t btrfs -o subvolid=5
# Assuming @ (or root) and optionally @home already exists,
# all you need is a new subvolume for snapshots.
btrfs subvolume create $TOP/.snapshot
btrfs subvolume create $TOP/.snapshots
```

### fstab
And then add a line to your `fstab` to mount the @.snapshots subvolume on every boot.

Example lines for fstab -
```fstab
# fstab: Example for root. Notably, use subvol=/@, do not use subvolid.
UUID=BTRFS_VOL_UUID / btrfs rw,noatime,ssd,space_cache=v2,subvol=/@,compress=zstd 0 1
# fstab: Example for /.snapshots.
UUID=BTRFS_VOL_UUID /.snapshots btrfs rw,noatime,ssd,space_cache=v2,subvolid=260,subvol=/@.snapshots 0 2
```

Replace `BTRFS_VOL_UUID` with the uuid from `lsblk
-f`, for the partition where the subvolumes reside.

## Config File

Once you create a config, automated snapshots should start running.
Expand Down

0 comments on commit c5f9068

Please sign in to comment.