Deleting files mounted via CIFS doesn't always work under Alpine Linux
In docker
containers running Alpine Linux there are issues with deleting files from Hetzner's Storage Boxes mounted via CIFS. Didn't have a chance to try it with anything else. Supposedly when one needs to delete more than a couple of files:
On the host (Ubuntu 20.04.1 LTS):
$ apt install cifs-utils
$ mount.cifs -o user=...,pass=...,file_mode=0600,dir_mode=0700 //....your-storagebox.de/backup /mnt
$ cp -r /usr/share/mime /mnt
$ find /mnt/mime -type f | wc -l
803
$ rm -r /mnt/mime
In a docker
container (Alpine Linux 3.15):
$ docker run --rm -it --privileged alpine:3.15
$ apk add cifs-utils mc
$ mount.cifs -o user=...,pass=...,file_mode=0600,dir_mode=0700 //....your-storagebox.de/backup /mnt
$ cp -r /usr/share/mc /mnt
$ find /mnt/mc -type f | wc -l
127
$ rm -r /mnt/mc
rm: can't remove '/mnt/mc/syntax': Directory not empty
$ find /mnt/mc -type f | wc -l
39
$ rm -r /mnt/mc
In a docker
container (Ubuntu Jammy):
$ docker run --rm -it --privileged ubuntu:jammy
$ apt update
$ apt install cifs-utils
$ mount.cifs -o user=...,pass=...,file_mode=0600,dir_mode=0700 //....your-storagebox.de/backup /mnt
$ cp -r /usr/share/mime /mnt
$ find /mnt/mime -type f | wc -l
824
$ rm -r /mnt/mime
Under some conditions you might end up with a directory you can't delete (cp -r /bin /mnt
).
There's also a peculiarity with symlinks, but that is probably expected and unrelated.