5

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

1 Answer 1

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 

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.