4

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#
  • 5
    Likely trailing whitespace; try ls -Q or ls -b – Jeff Schaller Apr 14 '18 at 15:45
  • 2
    nice, its a whitespace../overlay# ls -Q "etc" "lost+found" "storage" "storage " "upper" "work" – Bharat Apr 14 '18 at 15:51
7

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 or ls -b. You can manipulate (rename or delete) the one you want by using find with the -inum predicate to specify the inode number, or use shell globs with interactive prompting; something like:

for f in storage*; do printf 'removing: —>%b<—\n' "$f"; rm -i -- "$f"; done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.