How to delete a file named "filen/ame" (with slash) on an ext4 filesystem in debugfs?
If you want a fix and are not just trying out debugfs
, you can have fsck do the work for you. Mark the filesystem as dirty and run fsck -y
to get the filename changed:
$ debugfs -w -R "dirty" /tmp/ext4fs
$ fsck -y /tmp/ext4fs
...
/tmp/ext4fs was not cleanly unmounted, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Entry 'filen/ame' in / (2) has illegal characters in its name.
Fix? yes
...
$ debugfs -w -R "ls" /tmp/ext4fs
2 (12) . 2 (12) .. 11 (20) lost+found 12 (980) filen.ame
Congradulations on fsck working; if for some reason it didn't work the answer is ls -i1
followed by umount
and then clri
.
Ref: http://docstore.mik.ua/orelly/unix/upt/ch23_13.htm
I have actually tested this method.