Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files Removed from webdav path when removing volume #6

Closed
gimmeker opened this issue Apr 23, 2020 · 8 comments
Closed

Files Removed from webdav path when removing volume #6

gimmeker opened this issue Apr 23, 2020 · 8 comments

Comments

@gimmeker
Copy link

When i delete a volume from docker, the files on webdav server are also deleted.
Is it possible to remove a volume without deleting the content of the webdav folder ?

@fentas
Copy link
Owner

fentas commented Apr 26, 2020

You mean if you do a docker volume rm ... it's deleting files from your webdav endpoint?
🤔 This should not happen at all.
Can you clarify? Thanks 🙌

@gimmeker
Copy link
Author

Yes thats exactly what happens. I have a backup of the volume but it takes some time to restore the volume. Yesterday i tested it again with docker volume rm -f . If i look on the webdav endpoint in the web interface i can see de folder being emptyed slowly. Also the docker rm -f syntax times out most likely because it takes to much time to delete files. I found there are 2 volumes with a diffrent name but the same path could this be an issue ?

@gimmeker
Copy link
Author

gimmeker commented Apr 28, 2020

Ok i tried reproduce the problem on a diffrent system. And there it works ok. Strange thing about the system where it doesnt work ok. Is that the mount points for those volumes are the same on the docker host. That isnt the case on the system where it works ok.

Machine that has that problem.
image

Machine that works ok.
image

@fentas
Copy link
Owner

fentas commented May 19, 2020

🤔 wired. So the plugin does only an umount and removes the folder, I think.
Wouldn't know how this could happen. Guess we could update the repo from the latest version of sshd.

@gimmeker
Copy link
Author

Well for time being i let these existing volumes remain it doesnt seem to affect newly created volumes only the volumes that already exist with the same id this way i can work around the problem and i am planning to remove all the volumes with the same and only recreate the ones i need i hope the solve the problem this way.

@fentas
Copy link
Owner

fentas commented May 28, 2020

well, I don't think the deleting part when unmounted is happening from the plugin itself.
If you think you can solve that problem that way, feel free to close the issue. 🐱

@gautierrog
Copy link

gautierrog commented Jan 27, 2023

For anyone who has this issue. We recently had a similar issue of data loss with the vieux/sshfs plugin. It seems the problem arises when:

  • n volume pointing to same location
  • one of these volume is currently in use
  • when removing the unused volume

a way to reproduce:

# 
mkdir -p /tmp/sshfs
echo "hello" > /tmp/sshfs/file
docker run --rm --publish=2222:22 -v /tmp/sshfs:/tmp/sshfs sickp/alpine-sshd:7.5-
r2

#
docker volume create -d vieux/sshfs -o sshcmd=root@localhost:/tmp/sshfs -o port=2222 -o password=root sshvolume-local
docker volume create -d vieux/sshfs -o sshcmd=root@localhost:/tmp/sshfs -o port=2222 -o password=root sshvolume-local2

#
docker run --rm -d -v sshvolume-local:/tmp/sshfs nginx

# Data loss!
docker volume rm sshvolume-local2
# Data loss!

@StudioEtrange
Copy link

StudioEtrange commented Mar 3, 2023

One fix could be to replace os.RemoveAll by os.Remove
I have tried it successfully so far in this implementation : https://github.com/StudioEtrange/docker-volume-bindfs
which is a plugin built like sshfs plugin but with bindfs functionnality
see https://github.com/StudioEtrange/docker-volume-bindfs/blob/6a793cba0ef51443d67d54eeb170b7a4d7e86461/main.go#L268

(inspiration taken from https://github.com/ucphhpc/docker-volume-sshfs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants