I need help checking and repairing a BTRFS partition. It all started with a few directories on my system being inaccessible. Permissions of these directories are shown with question marks when I execute ls -l
:
d????????? ? ? ? ? dir1/
d????????? ? ? ? ? dir2/
d????????? ? ? ? ? dir3/
I suspect something went wrong during my last backup with rsync
. When I try to delete one of these directories with rm -frv dir1
I obtain the following error:
rm: cannot remove 'dir1': Input/output error
I unmounted the partition and ran the BTRFS' check with
sudo umount /dev/sda1
sudo btrfs check /dev/sda1
I obtain numerous errors of the type:
root 5 inode 77131 errors 2001, no inode item, link count wrong
unresolved ref dir 68134 index 0 namelen 11 name <filename.ext> filetype 1 errors 6, no dir index, no inode ref
Please find below the summary of the btrfs check
command:
ERROR: errors found in fs roots
found 291234099200 bytes used, error(s) found
total csum bytes: 268053312
total tree bytes: 372293632
total fs tree bytes: 58654720
total extent tree bytes: 7356416
btree space waste bytes: 45522801
file data blocks allocated: 290844143616
referenced 290844143616
Would you please guide me here? How do I repair the file system? The manual page of the btfrs check
warns against using the repair
command.