Background
I am playing around with BTRFS in a VM.
I followed this guide to make sure my /home/.snapshot
folder is its own sub-volume. Everything seems to work, I can take snapshots, list snapshots, undochanges
, etc.
Experimenting with Send/Receive
Steps:
- Use send/receive to send snapshot id 1 to a different subvol
- Use snapper to delete the snapshot id 1
- Use send/receive to bring snapshot id 1
- Snapper no longer recognizes snapshot id 1
Details:
I sent an existing snapshot to a different sub-volume (device)
sudo btrfs subvolume list -t /mnt_device3
ID gen top level path
-- --- --------- ----
256 9 5 @backup
sudo mkdir /backup/1
sudo btrfs send /home/.snapshots/1/snapshot | sudo btrfs receive /backup/1
sudo btrfs subvolume list -t /backup
ID gen top level path
-- --- --------- ----
256 17 5 @backup
258 18 256 1/snapshot
Then I used snapper to delete the snapshot:
sudo snapper -c home delete 1
sudo snapper -c home list
# | Type | Pre # | Date | User | Cleanup | Description | Userdata
---+--------+-------+-----------------------------+------+---------+--------------------------------------------------+---------
0 | single | | | root | | current |
2 | single | | Tue 04 Jul 2023 03:20:01 PM | root | | testing send/receive after test.txt |
Then I used send/receive again to put the snapshot back
sudo mkdir /home/.snapshots/1
sudo btrfs send /backup/1/snapshot | sudo btrfs receive /home/.snapshots/1
ls /home/.snapshots
total 0
drwxr-xr-x 1 root root 6 Jul 4 16:30 .
drwxr-xr-x 1 root root 32 Jun 29 11:36 ..
drwxr-xr-x 1 root root 16 Jul 4 16:11 1
drwxr-xr-x 1 root root 32 Jul 4 15:20 2
#an excerpt of sudo btrfs subvolume list /home
ID 311 gen 1147 top level 272 path 2/snapshot
ID 313 gen 1214 top level 272 path 1/snapshot
But snapper does not recognize snapshot 1
sudo snapper -c home list
# | Type | Pre # | Date | User | Cleanup | Description | Userdata
---+--------+-------+-----------------------------+------+---------+--------------------------------------------------+---------
0 | single | | | root | | current |
2 | single | | Tue 04 Jul 2023 03:20:01 PM | root | | testing send/receive after test.txt |
So I can't really use snapper to do anything with snapshot 1 anymore.
Is there a way I can get snapper to recognize the imported snapshot?