0

I have a file named .viminfo in home directory. I can see that the file is there by ls -lh:

$ ls lh
...
drwxr-xr-x.  2 mt1022  1091 4.0K Oct 12  2016 .vim
-??????????  ? ?         ?        ?            ? .viminfo
-rw-r--r--.  1 mt1022  1091  305 Nov  9  2013 .vimrc
...

However I cannot delete this file:

$ rm .viminfo
rm: cannot remove '.viminfo': No such file or directory

I saw somewhere that such files are corrrupted can be deleted by inode number. However, when I run ls -i I got the following output for the file:

145563901919042729 .cpan            144115239380596661 .vim     
145563901918974272 .cpanm                            ? .viminfo 
145564136279985406 .dask            144115238810163333 .vimrc  

I also tried sudo chmod g+x .viminfo (answer to a very similar post on this site). I still got no such file or directory error.

My question is How to delete such a corrupted file?


additional info that might be helpful:

  1. The file is stored on a lustre file system.
  2. The file was normal before and become corrupted after a recent sudden power outage.
  3. The file is not fixed during fsck.
mt1022
  • 101
  • 4
  • Is that directory you on a NFS share or any other network filesystem? – Thomas Jul 29 '18 at 09:24
  • @Thomas, sorry for the delay. the file is on a local lustre file system. – mt1022 Jul 29 '18 at 11:28
  • 1
    In that case you should check your lustre stuff for errors or excessive caching of dnode entries. What this basically means is that the inode block of the file is not accessible anymore, but the directory entry got not deleted. You could try `echo 3 > /proc/sys/vm/drop_caches` to get rid of caches, but I doubt that will do the trick and the problem is somewhere deeper. – Thomas Jul 29 '18 at 11:37
  • @Thomas, Thanks for the suggestion. I am quite a layman of this field. I'll ask the administrator to try that when he is available. – mt1022 Jul 29 '18 at 11:44
  • 1
    Your filesystem is _still_ corrupt. Go run [lfsck](https://github.com/Xyratex/lustre-stable/blob/master/Documentation/lfsck.txt). Don't try to do anything else until you've fixed it. – Michael Hampton Jul 29 '18 at 12:55
  • @MichaelHampton, I guess it is too late :(. I didn't realize this and uploaded ~500G files several hours ago. Also I am not the only user of this cluster. – mt1022 Jul 29 '18 at 13:05
  • I hope you still have a copy of those files. They may or may not have survived. I don't know where your cluster admin is, but this is something that he should be paged out of bed for. – Michael Hampton Jul 29 '18 at 13:07
  • @MichaelHampton, luckily the other files are fine. The `.viminfo` is a log file for `vim` and nothing import in it. But the file cannot be accessed, a warning will be echoed every time I exit vim. I am considering change the default path of [`.viminfo`](https://stackoverflow.com/questions/6286866/how-to-tell-vim-to-store-the-viminfo-file-somewhere-else). – mt1022 Jul 29 '18 at 13:19

1 Answers1

1

The question marks in the ls output indicate that it could not stat() the directory entry.

You can also see those if you try to list a directory for which you have r(ead) but not x (search) permission. However, in that case, it would not report I/O error.

In your case it seems to me like there is some disk or filesystem corruption.

Try checking dmesg or /var/log/messages for more information.

Itai Ganot
  • 10,424
  • 27
  • 88
  • 143