1

I have a backup that was copied from Linux (ext4) to an exFAT filesystem. File and directory names that end with a period are inaccessible.

I can (partly) list them, but ls behaves strangely. It prints errors like ls: cannot access '….': No such file or directory, and then prints the file name (with final period included), but reports -????????? for the permissions and ? for user, group, etc. I also can't move, rename, or delete any of the affected files. Using wildcards for the offending . does not work.

This isn't a permissions issue. It might be a filesystem corruption issue, but if it is, it is a systematic one caused by rsync'ing a directory from an ext4 to exFAT filesystem, and affects all files and directories whose name ends in .. The command sudo fsck.exfat -v -p /dev/sd** reports volume clean.

System info

This is a Ubuntu Studio Ubuntu 22.04.1 LTS machine running the 6.2.0-1018-lowlatency kernel.

The exFAT is an external USB drive (WD MyBook). I am mounting it via the system default mount option via the disks graphical user utility.

The output of cat /proc/filesystems includes exfat, indicating kernel support; exfat-fuse is not installed, so it is probably not mounting via fuse.

My questions:

  1. What is going on here?
  2. Do these files really exist, or are they ghosts (failed to copy to exFAT for reasons)?
  3. Can I recover this? I'd like to rename all affected nodes by removing the trailing period.
7
  • 1
    Are you using a FUSE driver or one in the kernel? I've just tested with a FUSE driver (mount -t fuse.exfat-fuse …) and it allowed filenames ending with a dot Commented May 13 at 17:03
  • The output of cat /proc/filesystems includes exfat, indicating kernel support, but I cannot rule out that fuse might be handling exfat mounting. The fuse and fusefat packages are installed. Edit: exfat-fuse is not installed, so presumably it is mounted through the kernel module. Commented May 13 at 17:12
  • I installed exfat-fuse and mounted with the command sudo mount.exfat-fuse /dev/sd** /media/DRIVENAME. It seems to work now. Must be a bug in the kernel's exFAT support. If you rephrase your comment as an answer, I will accept it. Commented May 13 at 17:35
  • 1
    In Debian with kernel 6.1.0 I created an exFAT and mounted (not as FUSE), then e.g. touch n. gave me a file named n. So yes, there is something fishy with filenames ending with a dot, possibly in your kernel as well. I haven't managed to create n. though, even with rsync (not that I have tried very hard, I admit). Commented May 13 at 18:34
  • 1
    You could report that bug in bugzilla.kernel.org. Commented May 16 at 10:52

2 Answers 2

2

-????????? is typically a symptom of filesystem corruption.

Unmount the disk and run fsck.exfat /dev/... (insert appropriate disk/partition for the ellipses).

1
  • sudo fsck.exfat -v -p /dev/sd** reports volume clean. Commented May 13 at 17:18
2

This is a bug in the kernel-level exFAT drivers.

  • Unmount the drive (for example by clicking the ⏹️ stop button in the Disks utility)
  • Note your partition device file name, which we will call /dev/sd_MYDEVICELETTER_MYPARTITIONNUMBER
  • sudo apt-get install exfat-fuse
  • Prepare a mount location folder, for example /media/MOUNT_LOCATION, with the correct permissions
  • Mount with the command sudo mount.exfat-fuse /dev/sd_MYDEVICELETTER_MYPARTITIONNUMBER /media/MOUNT_LOCATION

You should now be able to interact with files and directories with names ending in .. To automatically remove training periods, you can run these commands from the drive mount folder to rename offending files and directories, respectively:

find . -type f -name '*.' -print -exec bash -c 'mv "$1" "${1%?}"' _ {} \;

find . -type d -name '*.' -print -exec bash -c 'mv "$1" "${1%?}"' _ {} \;

If a directory contains two files a and a. this might overwrite a in the rename and case data loss. You may need to run the last command multiple times until no directories ending in . are present.

2
  • 1
    Thanks! Same problem here in Debian 12, and same solution. Is it possible to put the drive in fstab with exfat-fuse for a filesystem, so that it mounts correctly the next time I plug it in? Commented Jun 13 at 15:19
  • 1
    I don't personally know how to do that, but I don't really know much about Linux. I use fstab for internal drives that should always be available, and the system requires to boot. I seem to remember putting a drive that isn't currently attached into fstab will cause the boot to hang for a bit waiting for the drive. Commented Jun 15 at 21:14

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.