stashapp / stash

An organizer for your porn, written in Go. Documentation: https://docs.stashapp.cc
https://stashapp.cc/
GNU Affero General Public License v3.0
9.35k stars 803 forks source link

[Bug Report] Directory move is broken? #5440

Closed throwaway961 closed 4 days ago

throwaway961 commented 3 weeks ago

I'm trying to move from a Windows-based fileserver to Linux without losing all of my metadata and the generated images.

Previously, I was using the D:\private\organized\, D:\private\VR\, D:\private\unorganized\, etc. locations. Now it's the /mnt/private/organized/, /mnt/private/VR/, /mnt/private/unorganized/ location, etc. I've got my config.yml updated to have the new locations added. No permissions issues or anything, all of that is set up.

When Stash attempts to walk the directory tree, it's getting confused as all hell. It seems to be merging the two folder names into one long name or something, there's no space before the D:\ part.

2024-11-02 23:13:23
Error   
error processing "/mnt/private/VR/BadoinkVR": detecting folder move: walking filesystem for folder rename detection: checking for parent folder "/mnt/private/VR/D:\\Private\\VR\\BadoinkVR": lstat /mnt/private/VR/D:\Private\VR\BadoinkVR: invalid argument

File paths are getting destroyed too: image

If it helps:

image

WithoutPants commented 2 weeks ago

Migrating between filesystems with different path separators (/ and \) is currently unsupported.

WithoutPants commented 2 weeks ago

Further to this, the workaround is to manually migrate the folders table using SQL. It will require two separate SQL statements, in your case:

UPDATE folders SET path = REPLACE(path, '\', '/');
UPDATE folders SET path = REPLACE(path, 'D:/', '/mnt/');

Backup your database before doing this! These statements have not been tested, but I have done the opposite during testing.