Closed dionorgua closed 8 months ago
Thank you for the detailed bug report.
The dataset/subvol is called /snapshots
but is mounted at /.snapshots
?
I think what happened here is somewhere along the way I assumed the btrfs
command output (only way to easily obtain snapshot info) corresponds to a directory and not a dataset. I'm not a btrfs
user, but I'll whip up a test case soon.
Are you running httm
using sudo
or equivalent? btrfs
snapshots are by default privileged.
Yes. They are similar for my setup, but they can be absolutely different.
I think right now 'flat' layout is most common. It means that 'top level' subvolume (with id=5) is used to store other subvolumes. Usually this 'top level' subvolume is not mounted. But can be mounted if needed (for example to add more subvolumes):
sudo mount -o subvolid=5 /dev/mapper/elitepad4-rootfs /mnt/tmp
% ls -1 /mnt/tmp
bbcrypt
containers
home
root
snapshots
work
Please note that not every 'directory' here is subvolume. For example to make /var/cache
a subvolume I can do one of:
var_cache
and put it to that /mnt/tmp
like others/mnt/tmp/var
as regular dir and make /mnt/tmp/var/cache
as subvolumeIn both cases later I'll need to add fstab
entry to mount that subvolume as /var/cache
. Or just mount it with -o subvol=/var_cache
or -o subvol=/var/cache
depending on which kind of 'flat' layout I use :)
There is also 'nested' layout where that default subvolid=5
is used as root filesystem. And every subvolume is created as is (without need to mount subvolume).
Right now 'flat' layout is usually used for 'system directories' and sometimes 'nested' is used for subvolumes inside /home/USER
.
But whole situation is even more complex. Nothing prevents using some sort of 'mixed' setup where, for example, /var
is 'flat' subvolume and /var/cache
is nested inside /var
I'm not sure that it's possible to handle all possible cases automatically. And I'm not sure that you want to implement all of this.
I just tried httm
first time, so I don't know all it's features. But to find all possible subvolumes for ~/.zshrc
you need to:
stat --format=%m ~/.zshrc
btrfs subvolume
:% sudo btrfs subvolume show /home
home
Name: home
UUID: d6106243-9294-cd45-a62c-449ae19f27ab
Parent UUID: -
Received UUID: -
Creation time: 2024-03-06 16:33:47 +0100
Subvolume ID: 257
Generation: 1311
Gen at creation: 8
Parent ID: 5
Top level ID: 5
Flags: -
Send transid: 0
Send time: 2024-03-06 16:33:47 +0100
Receive transid: 0
Receive time: -
Snapshot(s):
snapshots/home.20240307T1351
snapshots/home.20240307T1400
snapshots/home.20240307T1644
snapshots/home.20240307T1700
snapshots/home.20240307T1800
snapshots/home.20240307T1900
Quota group: n/a
You'll also get list of snapshots here
Parse /etc/mtab
to find where it's mounted. I think you'll need to find entry with same 'block device' and correct subvol
parameter:
/dev/mapper/elitepad4-rootfs on /.snapshots type btrfs (rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=261,subvol=/snapshots)
Calculate relative path
I know that this is too complex.. Plus I don't know about performance.
Are you running
httm
usingsudo
or equivalent?btrfs
snapshots are by default privileged.
Tried both. But I can access /.snapshots/home.20240307T1800/dion/.zshrc
as regular user
I'm not sure that it's possible to handle all possible cases automatically. And I'm not sure that you want to implement all of this.
Yeah, I understand it's pure insanity. btrfs
support has been a real pain in my backside.
Would you try cloning and trying this branch? Instructions on how to build are in the README.
Hi, It still doesn't work. debug2.txt
I'm not sure that it's possible to handle all possible cases automatically. And I'm not sure that you want to implement all of this.
Yeah, I understand it's pure insanity.
btrfs
support has been a real pain in my backside.Would you try cloning and trying this branch? Instructions on how to build are in the README.
Would you take another look? Now works with subvols on different mounts and nested subvols for me. Thanks!
I've checked 1f0db4c4214a55c43d4a055453040c13081a8a25. It still doesn't work. debug output changed. It detects snapshots but for some reason it thinks that all snapshots are for / volume
What is your output re: sudo btrfs subvolume show /
and sudo btrfs subvolume show /home
, etc.?
sudo btrfs subvolume show /
root
Name: root
UUID: 95822128-2007-9e4d-b4ad-6aa413bf1717
Parent UUID: -
Received UUID: -
Creation time: 2024-03-06 16:33:44 +0100
Subvolume ID: 256
Generation: 2621
Gen at creation: 8
Parent ID: 5
Top level ID: 5
Flags: -
Send transid: 0
Send time: 2024-03-06 16:33:44 +0100
Receive transid: 0
Receive time: -
Snapshot(s):
snapshots/rootfs.20240307T1351
snapshots/rootfs.20240307T1400
snapshots/rootfs.20240307T1644
snapshots/rootfs.20240307T1700
snapshots/rootfs.20240307T1800
snapshots/rootfs.20240307T1900
snapshots/rootfs.20240307T2000
snapshots/rootfs.20240307T2100
snapshots/rootfs.20240307T2227
snapshots/rootfs.20240307T2353
snapshots/rootfs.20240308T0000
snapshots/rootfs.20240308T1447
snapshots/rootfs.20240308T1500
snapshots/rootfs.20240308T1600
snapshots/rootfs.20240308T1700
snapshots/rootfs.20240308T1800
snapshots/rootfs.20240308T1900
snapshots/rootfs.20240308T2000
snapshots/rootfs.20240308T2100
Quota group: n/a
% sudo btrfs subvolume show /home
home
Name: home
UUID: d6106243-9294-cd45-a62c-449ae19f27ab
Parent UUID: -
Received UUID: -
Creation time: 2024-03-06 16:33:47 +0100
Subvolume ID: 257
Generation: 2622
Gen at creation: 8
Parent ID: 5
Top level ID: 5
Flags: -
Send transid: 0
Send time: 2024-03-06 16:33:47 +0100
Receive transid: 0
Receive time: -
Snapshot(s):
snapshots/home.20240307T1351
snapshots/home.20240307T1400
snapshots/home.20240307T1644
snapshots/home.20240307T1700
snapshots/home.20240307T1800
snapshots/home.20240307T1900
snapshots/home.20240307T2000
snapshots/home.20240307T2100
snapshots/home.20240307T2227
snapshots/home.20240307T2353
snapshots/home.20240308T0000
snapshots/home.20240308T1447
snapshots/home.20240308T1500
snapshots/home.20240308T1600
snapshots/home.20240308T1700
snapshots/home.20240308T1800
snapshots/home.20240308T1900
snapshots/home.20240308T2000
snapshots/home.20240308T2100
Quota group: n/a
I'm not sure that it's possible to handle all possible cases automatically. And I'm not sure that you want to implement all of this.
Yeah, I understand it's pure insanity.
btrfs
support has been a real pain in my backside. Would you try cloning and trying this branch? Instructions on how to build are in the README.
Would you take another look at https://github.com/kimono-koans/httm/tree/fix_btrfs?
77c878c547028a278dee8f810f96f746ca519f9b
Still same. debug4.txt
Still same. debug4.txt
I think this was my fault. I think httm
saw that your snapshot dir looked like a Snapper snapshot directory and just ran from there. It should work now?
Re: mine, I have one root and two subs, all contain snaps from different filesystems and all are detected.
8d9b3d8d19279176504ea340a7c8058792073aa7 doesn't work. debug5.txt
Can you give me your mount | grep btrfs
?
% mount | grep btrfs
/dev/mapper/elitepad4-rootfs on / type btrfs (rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=256,subvol=/root)
/dev/mapper/elitepad4-rootfs on /.snapshots type btrfs (rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=261,subvol=/snapshots)
/dev/mapper/elitepad4-rootfs on /home type btrfs (rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=257,subvol=/home)
/dev/mapper/elitepad4-rootfs on /home/bbcrypt type btrfs (rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=260,subvol=/bbcrypt)
/dev/mapper/elitepad4-rootfs on /home/dion/.local/share/containers type btrfs (rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=259,subvol=/containers)
/dev/mapper/elitepad4-rootfs on /home/work type btrfs (rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=258,subvol=/work)
/dev/mapper/elitepad4_cryptboot on /boot type btrfs (rw,noatime,ssd,discard=async,space_cache=v2,subvolid=5,subvol=/)
I fixed a small issue which may impact your use case given the actual semantics of a Rust std library function, but now it should work?
Would you take another look at https://github.com/kimono-koans/httm/tree/fix_btrfs?
I'll let you see my test setup, can you identify a difference? Your subvolumes don't lead with @
. Anything else? --
% mount | grep btrfs
/dev/zd0 on /mnt type btrfs (rw,relatime,ssd,space_cache=v2,subvolid=5,subvol=/)
/dev/zd0 on /mnt/garden type btrfs (rw,relatime,ssd,space_cache=v2,subvolid=256,subvol=/@garden)
/dev/zd0 on /mnt/veranda type btrfs (rw,relatime,ssd,space_cache=v2,subvolid=265,subvol=/@veranda)
% sudo btrfs sub show /mnt
/
Name: <FS_TREE>
UUID: dcba9a17-16d3-495a-9899-334ecca50f2b
Parent UUID: -
Received UUID: -
Creation time: 2024-03-07 16:36:31 -0600
Subvolume ID: 5
Generation: 41
Gen at creation: 0
Parent ID: 0
Top level ID: 0
Flags: -
Send transid: 0
Send time: 2024-03-07 16:36:31 -0600
Receive transid: 0
Receive time: -
Snapshot(s):
@garden/root-v1
@garden/root-v2
@garden/root-v3
@garden/root-v4
@garden/root-v5
1
2
root-v5
root-v6
% sudo btrfs sub show /mnt/garden
@garden
Name: @garden
UUID: 4e9bf1a7-8f68-3444-babf-3867986776a5
Parent UUID: -
Received UUID: -
Creation time: 2024-03-07 16:37:10 -0600
Subvolume ID: 256
Generation: 44
Gen at creation: 7
Parent ID: 5
Top level ID: 5
Flags: -
Send transid: 0
Send time: 2024-03-07 16:37:10 -0600
Receive transid: 0
Receive time: -
Snapshot(s):
@garden/1
@garden/2
@garden/3
@garden/4
5
sudo btrfs sub show /mnt/veranda
@veranda
Name: @veranda
UUID: cfecde7f-a5ad-a642-8e85-7eea0aae52ab
Parent UUID: -
Received UUID: -
Creation time: 2024-03-08 13:58:07 -0600
Subvolume ID: 265
Generation: 43
Gen at creation: 24
Parent ID: 5
Top level ID: 5
Flags: -
Send transid: 0
Send time: 2024-03-08 13:58:07 -0600
Receive transid: 0
Receive time: -
Snapshot(s):
@garden/v1
@garden/v2
@garden/v4
v3
v5
v6
Oops there was something wrong re: btrfs root parsing, please make sure to try at least: https://github.com/kimono-koans/httm/commit/b97d8cf43babd0df0362c634e06cd4ff0c87591f.
Hi, tried both 737bd0739335f3d9ffe12c9da8900e4cf2208256 and b97d8cf43babd0df0362c634e06cd4ff0c87591f. Both doesn't work.
I don't see much differences (except I use /
on btrfs). Yes, I don't use @
prefix.
Btw I also have /boot on btrfs
(different block device so different filesystem). If I temporary unmount it httm
doesn't work at all. It prints followed:
httm --unique=all --debug ~/.zshrc
Error: httm could not find any valid datasets on the system
Would it help if I create VM with setup similar to that I use and provide you with ssh to it? If so, can you share your SSH public key?
httm --unique=all --debug ~/.zshrc Error: httm could not find any valid datasets on the system
Are you sure you are using sudo
when you exec httm
? My guess is you are using sudo
when you exec btrfs
, but not when you exec httm
as discussed above.
I've added some error handling in the latest to inform the user.
Would it help if I create VM with setup similar to that I use and provide you with ssh to it? If so, can you share your SSH public key?
I'd be pleased to, but I really think it's something silly like above.
Ahh. Yes.. You're right.. I completely forgot about this. So with sudo
it works!.
Thanks for help!
Hi,
It doesn't work anymore with https://github.com/kimono-koans/httm/releases/tag/0.37.4
Okay, you're running httm
with sudo
and there are no other error messages?
Could you please give me your sudo btrfs subvolume show...
output for /home
and /.snapshots
and /
?
I think I just added a WARN
notice when your snapshots are perhaps unmounted to master
. Are your snapshots mounted?
Yes. root this time. Whole output was captured including stderr
sudo httm --unique=all --debug ~/.zshrc >/tmp/log_new.txt 2>&1
% sudo btrfs subvolume show /home
[sudo] password for dion:
home
Name: home
UUID: d6106243-9294-cd45-a62c-449ae19f27ab
Parent UUID: -
Received UUID: -
Creation time: 2024-03-06 16:33:47 +0100
Subvolume ID: 257
Generation: 15535
Gen at creation: 8
Parent ID: 5
Top level ID: 5
Flags: -
Send transid: 0
Send time: 2024-03-06 16:33:47 +0100
Receive transid: 0
Receive time: -
Snapshot(s):
snapshots/home.20240314T0027
snapshots/home.20240315T1209
snapshots/home.20240315T1300
snapshots/home.20240315T1400
snapshots/home.20240315T1500
snapshots/home.20240315T1600
snapshots/home.20240315T1700
snapshots/home.20240315T1800
snapshots/home.20240315T1900
snapshots/home.20240315T2000
snapshots/home.20240315T2100
snapshots/home.20240315T2200
snapshots/home.20240315T2300
snapshots/home.20240316T0000
snapshots/home.20240316T0100
snapshots/home.20240316T0200
snapshots/home.20240316T0300
snapshots/home.20240316T0400
snapshots/home.20240316T0500
snapshots/home.20240316T0600
snapshots/home.20240316T0700
snapshots/home.20240316T0800
snapshots/home.20240316T0900
snapshots/home.20240316T1000
snapshots/home.20240316T1100
snapshots/home.20240316T1200
snapshots/home.20240316T1300
snapshots/home.20240316T1400
snapshots/home.20240316T1500
snapshots/home.20240316T1600
snapshots/home.20240316T1700
snapshots/home.20240316T2123
snapshots/home.20240316T2200
Quota group: n/a
% sudo btrfs subvolume show /.snapshots
snapshots
Name: snapshots
UUID: aa7a8441-0210-0c4a-aa8d-2855630c5e74
Parent UUID: -
Received UUID: -
Creation time: 2024-03-07 13:35:43 +0100
Subvolume ID: 261
Generation: 15490
Gen at creation: 632
Parent ID: 5
Top level ID: 5
Flags: -
Send transid: 0
Send time: 2024-03-07 13:35:43 +0100
Receive transid: 0
Receive time: -
Snapshot(s):
Quota group: n/a
% sudo btrfs subvolume show /
root
Name: root
UUID: 95822128-2007-9e4d-b4ad-6aa413bf1717
Parent UUID: -
Received UUID: -
Creation time: 2024-03-06 16:33:44 +0100
Subvolume ID: 256
Generation: 15537
Gen at creation: 8
Parent ID: 5
Top level ID: 5
Flags: -
Send transid: 0
Send time: 2024-03-06 16:33:44 +0100
Receive transid: 0
Receive time: -
Snapshot(s):
snapshots/rootfs.20240314T0027
snapshots/rootfs.20240315T1209
snapshots/rootfs.20240315T1300
snapshots/rootfs.20240315T1400
snapshots/rootfs.20240315T1500
snapshots/rootfs.20240315T1600
snapshots/rootfs.20240315T1700
snapshots/rootfs.20240315T1800
snapshots/rootfs.20240315T1900
snapshots/rootfs.20240315T2000
snapshots/rootfs.20240315T2100
snapshots/rootfs.20240315T2200
snapshots/rootfs.20240315T2300
snapshots/rootfs.20240316T0000
snapshots/rootfs.20240316T0100
snapshots/rootfs.20240316T0200
snapshots/rootfs.20240316T0300
snapshots/rootfs.20240316T0400
snapshots/rootfs.20240316T0500
snapshots/rootfs.20240316T0600
snapshots/rootfs.20240316T0700
snapshots/rootfs.20240316T0800
snapshots/rootfs.20240316T0900
snapshots/rootfs.20240316T1000
snapshots/rootfs.20240316T1100
snapshots/rootfs.20240316T1200
snapshots/rootfs.20240316T1300
snapshots/rootfs.20240316T1400
snapshots/rootfs.20240316T1500
snapshots/rootfs.20240316T1600
snapshots/rootfs.20240316T1700
snapshots/rootfs.20240316T2123
snapshots/rootfs.20240316T2200
Quota group: n/a
I'd ask that you build from master
. I'm curious if some warning would be given now.
Please upgrade to latest: https://github.com/kimono-koans/httm/releases/tag/0.37.6
Still doesn't work. But now with some logs: log_new.txt
Obviously the subvol name /snapshots
is not resolving to the subvol mount /.snapshots
, which is weird because it was working for me.
I think perhaps this one is my fault. Perhaps I was using the wrong std library function. Would you build from this branch? See: https://github.com/kimono-koans/httm/tree/fix_btrfs_subvol_names
Thanks!
It works! log_new_works.txt
Describe the bug
httm
doesn't detect snapshots for me (just local access)There is no "single" way to manage snapshots. So I think my layout is somehow special.
I'm using "flat" layout (where root subvol with
subvolid=5
is not mounted). I've just a few 'subvolumes' insubvolid=5
with names likerootfs
,home
, etc.To start using snapshots I've created additional
snapshots
subvolume and mounted it to/.snapshots
.Just migrated from
snapper
because of I don't like it's.snapshots
layout inside volumeSnapshots are managed by
btrbk
.I think that
FS_TREE
may confusehttm
. Plus it's not enough to just strip it because 'FS_TREE/snapshots/' here meanssnapshots
subvolume, not mount point.I think follwed line from
mount
describes it:I think it's similar to https://github.com/kimono-koans/httm/issues/85
To Reproduce Steps to reproduce the behavior:
httm --unique=all --debug ~/.zshrc
Expected behavior Ideally it should automatically guess where snapshots are. Maybe provide some CLI parameter or env variable if autodetect is too diffficult.
Additional context Add any other context about the problem here. Perhaps you should include system details like:
httm 0.36.5
httm --debug
attached debug.log