0

I have a directory and there are two mysterious entries, they don't show inode number nor any other metadata. When I type ls -li in the command line I get:

$ ls -li
ls: no s’ha pogut accedir a 'clementine.db-journal': El fitxer o directori no existeix
ls: no s’ha pogut accedir a 'clementine.db-journal': El fitxer o directori no existeix
total 1356072
# Some normal files
  ? -????????? ? ?     ?             ?            ? clementine.db-journal
  ? -????????? ? ?     ?             ?            ? clementine.db-journal
# more normal files

The first ? is in place of the inode, the following group are the permissions, one I don't know, user and group, filesize, and date, finally the filename.

rm -f clementine.db-journal doesn't seem to help.

Are there tools to analyse directories in a lower level than ls? Is the directory broken? Can I fix it? Do I have to replace the whole directory? (with mkdir, cp, rm, rmdir)

Context information:

I use Clementine to listen to music. Clementine uses a sqlite database to store information. The Clementine database is located at ~/.config/Clementine/clementine.db. This entries appeared when I booted after a power loss (I know I need a UPS). The filesystem where this is sitting on is btrfs.

Edit:

As @DopeGhoti mentioned I run a filesystem check (the btrfs equivalent). The output follows:

$ sudo btrfs check /dev/sda6
Checking filesystem on /dev/sda6
UUID: 5ea692ab-c7b1-4618-be39-d82eaf5c6b34
checking extents
checking free space cache
checking fs roots
root 5 inode 2119729 errors 200, dir isize wrong
root 5 inode 2178458 errors 1, no inode item
        unresolved ref dir 2119729 index 541 namelen 21 name clementine.db-journal filetype 1 errors 5, no dir item, no inode ref
root 5 inode 2219774 errors 1, no inode item
        unresolved ref dir 2119729 index 1822 namelen 21 name clementine.db-journal filetype 1 errors 5, no dir item, no inode ref
root 5591 inode 1491275 errors 200, dir isize wrong
root 5591 inode 2076115 errors 1, no inode item
        unresolved ref dir 1491275 index 984 namelen 21 name clementine.db-journal filetype 1 errors 5, no dir item, no inode ref
root 5591 inode 2119729 errors 200, dir isize wrong
root 5591 inode 2178458 errors 1, no inode item
        unresolved ref dir 2119729 index 541 namelen 21 name clementine.db-journal filetype 1 errors 5, no dir item, no inode ref
ERROR: errors found in fs roots
found 810099113984 bytes used, error(s) found
total csum bytes: 789379208
total tree bytes: 1426243584
total fs tree bytes: 368427008
total extent tree bytes: 84656128
btree space waste bytes: 283686669
file data blocks allocated: 1116310724608
 referenced 821686456320

It's clear this entries are making some issues, they still remain.

  • After you recovered from the power loss (and incident unclean unmount of your filesystem), did you run an fsck? – DopeGhoti Apr 9 '18 at 22:54
  • no I didn't, I know I should have, in btrfs I think the command is btrfs check. good advice, thanks. – Falk Apr 9 '18 at 22:58
  • Now I did, I'll add the output to the question. – Falk Apr 9 '18 at 23:29
1

btrfs check will only show the problems. You need to use btrfs check --repair to (attempt to) fix the problems it finds. However, the vocal majority of documentation advises against using --repair. However, since the btrfsck does expose the inodes of the broken files, they can be deleted with e. g. find / -inum XXXX -delete (replace XXXX with the actual broken inode).

If you want to actually try to recover the files, that is a bit above my pay grade with btrfs, but the author of this answer may be able to point you in the right direction.

  • Yes, I don't want to risk my complete filesystem just because of a file that can't be removed, I'll search for some workaround if it's possible. find / -inum XXXX -delete doesn't seem to work, it says file or directory doesn't exist. I think I will create a new directory, copy all the good files in it, remove the bad one and finally rename the new directory so that it has the old name. – Falk Apr 10 '18 at 16:31
0

I had this exact same problem with a different file, prefs.js from .mozilla.

This was Fedora 28, btrfs-progs 4.15.1

I ended up single usering the workstation, ensuring the filesystem was unmounted, and running btrfs check --repair on the filesystem. Luckily this was a VM, so I was able to snapshot the filesystem first.

The repair worked as intended, and ended up deleting several million inodes errantly attached to the same file entry. I don't know what caused this problem, but the repair process worked for this specific error.

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.