Zygo / bees

Best-Effort Extent-Same, a btrfs dedupe agent
GNU General Public License v3.0
692 stars 56 forks source link

Re-built system, having issue with .beeshome #291

Closed SpiderUnderUrBed closed 2 weeks ago

SpiderUnderUrBed commented 2 months ago

I had to move all my stuff to a new partition to fix it, now beesd is not working, I am getting this error:

 beesd@root.service - Block-level BTRFS deduplication for root
Loaded: loaded (/etc/systemd/system/beesd@root.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Sun 2024-09-15 12:11:04 NZST; 2s ago
  Duration: 27ms
Invocation: 428c565b49e54675995e7a1a388f2c0c
   Process: 40699 ExecStart=/nix/store/7i9v6583vmbj3q2b53rwdyigyl44invi-bees-0.10/bin/bees-service-wrapper run LABEL=root verbosity=2 idxSizeMB=2048 workDir=.beeshome
-- --no-timestamps --loadavg-target 5.0 (code=exited, status=1/FAILURE)
   Process: 40732 ExecStopPost=/nix/store/7i9v6583vmbj3q2b53rwdyigyl44invi-bees-0.10/bin/bees-service-wrapper cleanup LABEL=root verbosity=2 idxSizeMB=2048 [workDir=.be](http://workdir=.be/)
eshome (code=exited, status=0/SUCCESS)
  Main PID: 40699 (code=exited, status=1/FAILURE)
IP: 0B in, 0B out
  Mem peak: 5.2M
CPU: 39ms

Sep 15 12:11:04 daspidercave systemd[1]: Started Block-level BTRFS deduplication for root.
Sep 15 12:11:04 daspidercave beesd[40699]: /run/bees/mnt/0095faf2-2359-4515-a1e1-af7ef6f11a0f/.beeshome exists but is not a subvolume
Sep 15 12:11:04 daspidercave systemd[1]: beesd@root.service: Main process exited, code=exited, status=1/FAILURE
Sep 15 12:11:04 daspidercave systemd[1]: beesd@root.service: Failed with result 'exit-code'.
warning: error(s) occurred while switching to the new configuration

I tried a series of commands, making a .beeshome on /, making bind mounts between /run/, trying to make subvolumes, nothing works

I also wrote the issue here: https://www.reddit.com/r/btrfs/comments/1fgzu6w/beesd_has_a_issue/

kakra commented 2 months ago

Change to the directory containing the .beeshome folder, then:

mv .beeshome .beeshome.old
btrfs sub create .beeshome
rsync -av .beeshome.old/. .beeshome/.
rm .beeshome/beeshash.dat # because the subvolumes differ

You didn't recreate the subvolume structure of your system while moving your data to a new partition.

bees will crawl all your data from scratch, expect some increased disk IO for a few hours or days. Also, expect bees to increase disk usage slightly during this time before finally cleaning up, so keep enough free space.

If everything works, you can remove .beeshome.old.

SpiderUnderUrBed commented 2 months ago

I am getting this issue:

[spiderunderurbed@daspidercave:/run/bees/mnt/0095faf2-2359-4515-a1e1-af7ef6f11a0f]$ btrfs sub create .beeshome
ERROR: not a btrfs filesystem: .

[spiderunderurbed@daspidercave:/run/bees/mnt/0095faf2-2359-4515-a1e1-af7ef6f11a0f]$ 

Which is strange because image

SpiderUnderUrBed commented 2 months ago

It seems like /run/bees/mnt/ uses tmpfs, any way to change this in plasma or beesd? I am getting a whole host of issues.

kakra commented 2 months ago

/run/bees/mnt/... is only mounted while bees is running - and bees exits immediately because of the error. So try mounting subvolid=0 first:

mkdir /mnt/btrfs-pool
mount -o subvolid=0 UUID=0095faf2-2359-4515-a1e1-af7ef6f11a0f /mnt/btrfs-pool

Now try my above steps in that directory.

It seems like /run/bees/mnt/ uses tmpfs, any way to change this in plasma or beesd? I am getting a whole host of issues.

/run is meant to be tmpfs, it's used for private runtime data and will be discarded on reboot. Services like bees create a private mount inside which is not to be used by you. To modify your btrfs, mount it manually, or run a more verbose lsblk command to find it's mount point. .beeshome must be present at the root of subvolid=0 - your standard btrfs mount point may not show that.

SpiderUnderUrBed commented 2 weeks ago

Sorry for the late response. Anyways.

mkdir /mnt/btrfs-pool
mount -o subvolid=0 UUID=0095faf2-2359-4515-a1e1-af7ef6f11a0f /mnt/btrfs-pool

This works while my system is up and running, but I was trying to make it execute before my system starts, with no avail, and this fix doesn't come without its own issues. So is there a underlying problem which can be addressed?

Here was my attempt at making a permanent fix:

   fileSystems."/mnt/btrfs-pool" = {
    device = "UUID=0095faf2-2359-4515-a1e1-af7ef6f11a0f";
    depends = ["/" "/mnt"];
    fsType = "btrfs";
    options = [ "subvolid=0" ];
  };

(note I use nixos)

Is there a issue with some recorded data I need to delete so it can recreate .beeshome?

kakra commented 2 weeks ago

Simply btrfs sub create /mnt/btrfs-pool/.beeshome. If it exists already, rename it first.

SpiderUnderUrBed commented 2 weeks ago

I made a few mistakes trying to clear out /mnt/btrfs-pool which lead to me requiring to re-install my system, regardless, the issue is fixed now.