1

I recently saw that I had two strangely named directories in my home folder. I tried to remove them but was unsuccessful. Here is a look at what I tried:

theo@locker:~$ lh
ls: cannot access ',jexcGMEs2uoH,6vFPgl5r3Y': No such file or directory
ls: cannot access 'IFslbdRBIjiaEYdbO83xWAed': No such file or directory
total 44K
drwxrwxr-x 2 theo theo 4,0K Feb 10 15:37 Archives
drwxr-xr-x 2 theo theo 4,0K Feb 10 14:38 Desktop
drwxr-xr-x 5 theo theo 4,0K Feb 10 15:41 Documents
drwxr-xr-x 2 theo theo 4,0K Feb 16 18:20 Downloads
d????????? ? ?    ?       ?            ? IFslbdRBIjiaEYdbO83xWAed
d????????? ? ?    ?       ?            ? ,jexcGMEs2uoH,6vFPgl5r3Y
drwxr-xr-x 2 theo theo 4,0K Feb 10 14:38 Music
drwxr-xr-x 3 theo theo 4,0K Feb 10 15:47 Pictures
drwxrwxr-x 2 theo theo 4,0K Feb 21 19:37 Private
drwxrwxr-x 6 theo theo 4,0K Feb 17 13:18 Projects
drwxr-xr-x 2 theo theo 4,0K Feb 10 14:38 Public
drwxr-xr-x 2 theo theo 4,0K Feb 10 14:38 Templates
drwxr-xr-x 3 theo theo 4,0K Feb 10 15:39 Videos
theo@locker:~$ rm -r IFslbdRBIjiaEYdbO83xWAed 
rm: cannot remove 'IFslbdRBIjiaEYdbO83xWAed': No such file or directory

I had no better luck with rm -f or sudo. I'm not sure where these files come from either. Does anybody have any ideas?

dessert
  • 39,982
  • rm -i -- * will go through each file in turn and offer to delete. Or you may need to ls -lab and possibly use unlink. – pbhj Feb 21 '18 at 21:27
  • 1
    what worked for me was to overwrite a directory with a same name with p flag mkdir -p foobar and then delete it. – Foad Sep 04 '18 at 22:47

1 Answers1

4

It's not a normal situation, but as per the tags, you are already aware that it's data corruption. With a corrupt filesystem, any further modification can lead to further unexpected results (even more corruption). The safest is to remount the filesystem read-only, backup/save everything on a different media, (encrypted if necessary), and only do attempt further modifications when the filesystem has been umounted, and an appropriate fsck has already processed the fs.

The rest of the similar questions seem to discuss weird filenames or weird filesystems - yours seem to be actually corrupt as the question mark in most of the fields show.

Update: I repeat, the issue does not seem to be a duplicate question regarding unusual/hard to see file names, but genuine filesystem corruption. Your hostname was suggesting that it's not an everyday system, so there might be some factors that can increase the chances of a corruption:

  • less reliably storage and/or connections (USB cables, USB dongle storage, SD cards, SD card converters)
  • system shut down at least once a day
  • not fully mature filesystems (which is mature enough is roughly a personal preference though)
  • journaling enabled file systems (it can hide corruption by masking the need for an fsck on an unorderly reboot)
  • encrypted storage/volume managers - generally they are stable enough, but they still add one layer of software to occasionally cause problems)

As it has been suggested, it's really a good idea to consider the above factors where the corruption may have been introduced to reduce the chances of it reoccurring. It's quite weird that a clean, 24-character ASCII printable corruption got in the directory entries, that's not really a typical corruption for otherwise stable systems.

In my experience, a corruption is either a single flipped bits in a few hundred megabytes of written data, or an occasional block of data (512b/4k, or even larger in the case of LVM/RAID) completely replaced by either garbage, or unrelated data bytes. If you notice anything that can explain the issue, feel free to let us know so that there's a record to help others.

But, back to your question - if it's your main/only filesystem on your main drive, then the forcefsck feature is your best bet.

See here - Force fsck safe?

You will need to reboot the system for this to work (and possibly even after the fsck has completed). You can also try to run the fsck yourself from a Live CD installation, which would allow you to see the results more easily.

chexum
  • 211
  • 3
  • 8
  • 1
    This one indeed looks like data corruption, and indeed most likely the first most important thing to do is to make sure that there's a backup of the data. In addition to running fsck, which might repair the filesystem, it would be nice to catch the underlying issue. It could be a disk fault, with relevant messages available in dmesg or the disk's SMART info. It could be RAM failure (in that case you probably see applications segfaulting more often than usually). There are probably plenty of other possible reasons. – egmont Feb 21 '18 at 21:32
  • Thanks guys, I've gone ahead and backed up everything i want to keep (luckily this system is less tan a week old, so it was pretty quick :p ) questin now is.. how do I unmount the filesystem so i can run fsck? – theopendle Feb 22 '18 at 20:22