Open cmurf opened 3 years ago
There is no need to use _fd variants since snapper uses ioctls directly that used fds. That is that way since btrfsutils simply did not exist when snapper was created and might still not be available on all systems snapper supports.
I am using the custom layout like the layout from Arch wiki
sudo btrfs su li -p /
ID 271 gen 232 parent 5 top level 5 path @home
ID 274 gen 232 parent 5 top level 5 path @
ID 264 gen 176 parent 5 top level 5 path snapshots/home
ID 265 gen 213 parent 5 top level 5 path snapshots/root
ID 266 gen 153 parent 264 top level 264 path snapshots/home/1/snapshot
ID 267 gen 122 parent 265 top level 265 path snapshots/root/1/snapshot
ID 268 gen 125 parent 264 top level 264 path snapshots/home/2/snapshot
ID 269 gen 214 parent 265 top level 265 path snapshots/root/2/snapshot
ID 270 gen 151 parent 264 top level 264 path snapshots/home/3/snapshot
ID 273 gen 186 parent 265 top level 265 path snapshots/root/3/snapshot
The directory snapshots
has two subvolumes home
and root
, they are the same as both names from snapper
configuration.
The custom layout should be nice, because it is easy for rollback, replace and moving without effort. Timeshift-btrfs layout is also good, because inclusive timestamp. all names of snapshot should be changed to timestamps like:
ID 266 gen 153 parent 264 top level 264 path snapshots/home/1/2022-03-21_09-02-31
ID 267 gen 122 parent 265 top level 265 path snapshots/root/1/2022-03-21_09-02-31
ID 266 gen 153 parent 264 top level 264 path snapshots/home/2/2022-03-22_10-10-10
ID 267 gen 122 parent 265 top level 265 path snapshots/root/2/2022-03-22_10-10-10
Timestamp is simply view more than number that you can not remember how old is this number.
Is this possible implemented in snapper layout?
I understand the problem, snapper does not know where are snapshots of @home when they are not in @home/.snapshots.
I have suggestion that the config file would add an option that lets you map, it contains key value pairs where you could optionally map the snapshot location to the correct subvolume.
Something like:
[Snapshot Locations]
@=snapshots/root
@home=snapshots/home
Source: https://gitlab.com/btrfs-assistant/btrfs-assistant/-/issues/2#note_889395719
Currently snapshots are nested inside a hidden .directory within the subvolume being snapshot. This has consequences:
find
,du
,locate
, backup, and various other tools include .snapshot directory and their results are skewedSolution:
Layout could just substitute .snapshots for snapper to make it clear who owns these snapshots; there could easily be other snapshot creators on Btrfs, e.g. btrbk
top-level ── snapper │ ├── 1 │ │ ├── info.xml │ │ └── snapshot │ ├── 2 │ │ ├── filelist-1.txt │ │ ├── info.xml │ │ └── snapshot │ ├── 3 │ │ ├── info.xml │ │ └── snapshot │ └── 4 │ ├── filelist-3.txt │ ├── info.xml │ └── snapshot
Rollback should create snapshots of snapshots, placing them in the top-level with a suitable name based on the info.xml schema. The same _fd facility can help with this; and then also set it as the default subvolume for booting. This way the active root is compartmentalized in its own namespace, leaving snapper snapshots contained in its own namespace.