BackgroundI have a folder named akorg. That Unicode character causes headaches for me when software makes incorrect assumptions about the text encoding of my file paths, so I'd like to remove it from the name.The problemYou'd think this would be easy:$ mv akorg akorgmv: cannot move akorg to a subdirectory of itself, akorg/akorgbutthat's strangeit thinks a folder called akorg already exists. I'm pretty sure there isn't one:$ ls -latotal 699Kdrwxr-xr-x 15 ak ak   15 Jun 12 17:34 .drwxr-xr-x 57 ak ak 4.0K Jun 12 17:35 ..drwxr-xr-x 11 ak ak   21 Jun 12 16:58 akorgdrwxr-xr-x  2 ak ak    2 May 28 20:47 Desktop...Still, stat says otherwise:$ stat akorg  File: akorg  Size: 21          Blocks: 33         IO Block: 1536   directoryDevice: 15h/21d Inode: 292128      Links: 11...So apparently there is an invisible folder in the way. Whatever, I'll just remove it:$ rmdir akorgrmdir: failed to remove akorg: No such file or directoryRight, then. What in the world is this thing?What I know so farI'm using the stable release of ZFS on Linux. Here's the zpool status and zfs properties.stat returns the same inode for both akorg and akorg. Searching by that inode returns only akorg:$ find . -maxdepth 1 -inum 292128./akorgMore things that don't work on the invisible folder:$ rm akorgrm: cannot remove akorg: Is a directory$ unlink akorgunlink: cannot unlink akorg: Is a directory$ mv akorg akorg_tempmv: cannot move akorg to akorg_temp: No such file or directoryI get the same results in both Bash 4.2.45 and zsh 5.0.0. In both, tab-completion of ak returns only akorg/.The strace of my initial renaming attempt confirms that I'm typing the names correctly and that the attempt is thwarted by the preexistence of a folder named akorg.This response to a more explicit renaming attempt is puzzling and scary:$ mv --verbose --no-target-directory --no-clobber akorg akorgremoved akorgI don't understand why it claims to have removed akorg, or why it would try. Fortunately, ls and stat akorg akorg reveal that nothing is actually gone. Here's the strace.To rule out encoding quirks as the cause of this, I've temporarily given akorg an intermediate name:$ mv --verbose --no-target-directory --no-clobber akorg bananasakorg -> bananasThat worked as expected,$ ls -latotal 715Kdrwxr-xr-x 16 ak ak   16 Jun 13 15:11 .drwxr-xr-x 57 ak ak 4.0K Jun 13 14:03 ..drwxr-xr-x 11 ak ak   21 Jun 12 16:58 bananasdrwxr-xr-x  2 ak ak    2 May 28 20:47 Desktop...but the invisible folder is still present:$ stat bananas akorg  File: bananas  Size: 21          Blocks: 33         IO Block: 1536   directoryDevice: 15h/21d Inode: 292128      Links: 11...  File: akorg  Size: 21          Blocks: 33         IO Block: 1536   directoryDevice: 15h/21d Inode: 292128      Links: 11...and mv still behaves strangely when I try to use the name akorg:$ mv --verbose --no-target-directory --no-clobber bananas akorgremoved bananas
How can I get rid of this invisible file?
linux;files;unicode;zfs
This is weird. (And this answer started as a comment ;), became a bit long for it.)Looking at the strace it looks like there are no hidden characters or the like, else I suspect you would have seen it in e.g. (which should have resulted in -1 ENOENT and not 0 if everything was OK):stat(akorg, {st_mode=S_IFDIR|0755, st_size=21, ...}) = 0as you do in:lstat(akorg\342\234\275, {st_mode=S_IFDIR|0755, st_size=21, ...}) = 0Came across a mail exchange where one person has the opposite problem. ls list the files, but stat give ENOENT  though that was on FreeBSD.I do not know much about zfs, but could it be that some sync, snapshot or the like has failed and left a corrupted file table? Did you create/have a directory named akorg that you deleted before you tried the mv?Do not know if you can get some error descriptions by:# zpool status -vOne thing to try is check the reverse inode lookup (optionally add yet another d) and check path:# zdb -dddd <pool-name> <inode>On a folder named baz:# zdb -dddd qqq 31Object  lvl   iblk   dblk  dsize  lsize   %full  type    31    1    16K    512     1K    512  100.00  ZFS directory                                    264   bonus  ZFS znodednode flags: USED_BYTES USERUSED_ACCOUNTED dnode maxblkid: 0path    /bazuid     1000gid     1000atime   Fri Jun 14 12:39:46 2013mtime   Fri Jun 14 11:55:33 2013ctime   Fri Jun 14 11:55:33 2013crtime  Fri Jun 14 11:55:33 2013gen 1510mode    40775size    2parent  3links   2xattr   0rdev    0x0000000000000000microzap: 512 bytes, 0 entriesOn a directory named foo holding several subdirectories including one named akorg:Object  lvl   iblk   dblk  dsize  lsize   %full  type    16    1    16K    512     1K    512  100.00  ZFS directory                                    264   bonus  ZFS znodednode flags: USED_BYTES USERUSED_ACCOUNTED dnode maxblkid: 0path    /foouid     1000gid     1000atime   Fri Jun 14 13:10:38 2013mtime   Fri Jun 14 12:13:18 2013ctime   Fri Jun 14 12:13:18 2013crtime  Fri Jun 14 11:41:53 2013gen 1482mode    40775size    6parent  3links   6xattr   0rdev    0x0000000000000000microzap: 512 bytes, 4 entries    foo1 = 15 (type: Directory)    foo2 = 18 (type: Directory)    foo = 19 (type: Directory)    akorg = 30 (type: Directory)The settings you have on zfs get all storage/home-ak-annex for various name mod also looks sane (as far as I can tell) as well as the other properties by reading ZFS Properties:storage/home-ak-annex  utf8only              off                    -storage/home-ak-annex  normalization         none                   -storage/home-ak-annex  casesensitivity       sensitive              -If you build zfs yourself you can enable debug by ./configure --enable-debug and play with the above including -vvvv, -bbbb etc.Lastly you could open a new Issue on the git.