gboudreau / Greyhole

Greyhole uses Samba to create a storage pool of all your available hard drives, and allows you to create redundant copies of the files you store.
http://www.greyhole.net
GNU General Public License v3.0
263 stars 34 forks source link

Failed file copy (using rename) #324

Closed michaepr closed 10 months ago

michaepr commented 10 months ago

Hello,

I've been following GH's log as I'm writing data to a test setup. There are three drives, the shares folder is on the first drive. Now I copy a file to a share (in the screenshot below called Photography). In this case I'm using the alternative drive selection algorithm so drives 0 and 1 are chosen. Copying the new file _test_file4 to drive 0 is postponed because it's on the same drive as the shares folder. The file is then copied to drive 1 and on the share on drive 0 a symlink is created to the file on drive 1. So far so good.

Judging from the next log entries it seems to me that GH now attempts to use rename to copy the new file from the shares folder to the gh folder on drive 0. It then fails because file sizes don't match (presumably because the rename command copies the symlink rather than the actual file?).

Then GH copies the file on drive 1 to drive 2 and creates a symlink in the shares folder to the file on drive 2. Then it creates another copy on drive 0 and removes the (previously copied) file on drive 1.

So it looks like the rename error creates a lot of unnecessary copies.

2024-01-13_16:41:27

I then tried the same with the default drive selection algorithm. The output is a bit different but the rename still fails and it looks like an additional copy (from drive 2 to drive 0 in this case) is done.

2024-01-13_17:02:14

Would you be able to check that out? Or is there anything I can change in my setup?

gboudreau commented 10 months ago

(Please paste your logs in text format next time; just copy-paste in here, and use ``` above and below those text blocks.)

That seems like a regression from previously working code that created file copies using renaming. I'll try to reproduce it on my side.

gboudreau commented 10 months ago

Please try version 0.5.21, to see if it fixes the issue for you.

michaepr commented 10 months ago

Yes that seems to have worked (based on a quick test). Thanks for your fast reply!