Why I am seeing two files (directories) in the same directory with same name ‘storage’? The inode numbers are different.
root@OpenWrt:/# fsck.ext4 -p /dev/sda1
/dev/sda1: clean, 2213/979200 files, 2026329/3912206 blocks
root@OpenWrt:/#
root@OpenWrt:/# mount /dev/sda1 /mnt
root@OpenWrt:/# cd /mnt
root@OpenWrt:/mnt# ls -l
drwxr-xr-x 2 root root 4096 Jan 1 1970 etc
drwx------ 2 root root 16384 Jan 31 21:16 lost+found
drwxr-xr-x 9 root root 4096 Apr 14 2018 storage
drwxr-xr-x 3 root root 4096 Jan 20 2018 storage
drwxr-xr-x 11 root root 4096 Apr 3 2018 upper
drwxr-xr-x 3 root root 4096 Jan 1 1970 work
root@OpenWrt:/mnt# ls -li
261121 drwxr-xr-x 2 root root 4096 Jan 1 1970 etc
11 drwx------ 2 root root 16384 Jan 31 21:16 lost+found
391681 drwxr-xr-x 9 root root 4096 Apr 14 2018 storage
783361 drwxr-xr-x 3 root root 4096 Jan 20 2018 storage
130561 drwxr-xr-x 11 root root 4096 Apr 3 2018 upper
522241 drwxr-xr-x 3 root root 4096 Jan 1 1970 work
root@OpenWrt:/mnt#
Best Answer
Files in the same directory that look visually similar, on a filesystem that’s not corrupted, will have different inodes and filenames. In this case, there appears to be trailing whitespace. Inspect the filenames by using
ls -Q
orls -b
. You can manipulate (rename or delete) the one you want by usingfind
with the-inum
predicate to specify the inode number, or use shell globs with interactive prompting; something like: