How to delete files after EXT4-fs error: Directory hole found
Solution 1:
Directory-holes are actually a feature of ext4 since 2013 but the Linux kernel was not fixed to support it until late 2019. However directory-holes can only be formed as a result of running fsck, so it could indirectly be caused by data errors that forced you to run fsck.
The following fsck option should remove all directory holes :
fsck.ext4 -Df dm-0
Be sure to run on an unmounted file-system (will also work on a read-only mounted file system, but there is a slight risk that anyone reading files while fsck is running will get garbage).
Be warned that this will take at least as long as a full fsck (eg fsck.ext4 -f dm-0
), and during this period the filesystem will not be available for use.