0

Problem

I have a file that cannot be removed or queried in, but it does appear using ls and does not allow overwriting it.

# ls -l
-rwxr-xr-x 1 root root 151040 Mar 22 21:55 export.mb
-rwxr-xr-x 1 root root  60416 Mar 25 10:48 source.mb

All of these commands don't work:

# rm export.mb
rm: cannot remove 'export.mb': No such file or directory

# lsattr export.mb
lsattr: No such file or directory While reading flags on export.mb

# echo "" > export.mb

# ls export.mb  # <-- This does show the file
export.mb

Context

The file is located on a CIFS mount, here is the relevant /etc/fstab entry:

# /etc/fstab
(...mountpoints...) cifs credentials=/root/share.creds,user_xattr  0 0

The file comes from an rsync copy using these flags:

rsync --update --human-readable --itemize-changes --stats -amz --log-file=$LOGFILE $SRC_DIR $DST_DIR

The rsync command worked normally for a time. The log from the day before the issue shows it as normal:

2024/04/17 03:36:56 [115611] .f...pog... export.mb

Then this starts showing up:

2024/04/18 03:20:43 [117623] >f.stpog... export.mb
2024/04/18 03:20:43 [117623] rsync: rename ".../.export.mb.79sd8g" -> ".../export.mb": No such file or directory (2)

Attempted solutions

I tried the following but these did not work.

Ensuring no strange characters

Using ls -b does not show any strange characters. Tab completion works in the terminal too, although I don't know if that's enough of a guarantee that there are no weird characters going on.

Deleting by inode

# ls -i
562949970325155 export.mb
2533274793978866 source.mb
# find . -inum 562949970325155
./export.mb
# find . -inum 562949970325155 -exec /bin/rm {} \;
/bin/rm: cannot remove './export.mb': No such file or directory

Deleting it from the SMB server directly.

Deleting it on the Windows Server directly has the same issue. It cannot delete the file.

Specifically, doing it from Windows Explorer for example will show the file is deleted. But if you refresh it, it's still there.


Any suggestions on how to tackle this would be greatly appreciated!

4
  • Have you tried just doing a simple unmount and then remmount? You can do this with: umount /your/mount/point and then mount -a? I know it sounds too simple but it works!
    – Hman66
    Commented Apr 30 at 8:51
  • Thanks for the suggestion. I gave that a try but alas it did not work.
    – ricekab
    Commented Apr 30 at 9:25
  • Deleting it on the Windows Server directly has the same issue - so, it has nothing to do with cifs, with the share, with bash or with linux at all. You let everybody read through a wall of irrelevant stuff even though you've already determined that the problem is somewhere else. Please stick to the relevant facts in the future. Commented Apr 30 at 12:48
  • It remains that the file got there via rsync from a Ubuntu machine. I will clarify the point in the original post as it seems my last paragraph got lost in the submission.
    – ricekab
    Commented Apr 30 at 13:03

1 Answer 1

0

Deleting it on the Windows Server directly has the same issue

You need to determine the process that has an open handle to the file on the Windows server. You can use Sysinternals Handle.exe to show the process with the handle(s) to the file.

https://learn.microsoft.com/en-us/sysinternals/downloads/handle

1
  • Thank you for the suggestion. Running handle on it seems to indicate there are no open handles with No matching handles found.
    – ricekab
    Commented Apr 30 at 13:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .