I have broken filesystem inside qnap. When I'm trying to fsck, it going into endless loop on one inode. Unfortunately qnap haven't debugfs command. Is this possible to remove (clear) inode via dd?

  • First I'd like to say sorry cause this may not be thought as an answer. But I don't know how to contact the author, so I can just post here. Zulus, can you try to contact qnap support? Or you can just contact me through [email protected]. According to the NAS model you used, we will provide the correct debugfs to you. Thanks.
    – Kevin Liao
    Commented Oct 26, 2016 at 2:36
  • I sent You email and created ticket: JWZ-569-66890. Thank You.
    – zulus
    Commented Oct 27, 2016 at 20:18

1 Answer 1


It's possible but it's highly dangerous. If you screw it up, you could end up doing more damage. The trick is calculating the offset to the particular inode, given the output of dumpe2fs. Once you calculate the offset it's just:

dd if=/dev/zero of=/dev/BLOCKDEVICE seek=OFFSET bs=1 count=INODESIZE

See the source code of debugfs for the function do_imap:

The starting location of the inode table (which is what ext2fs_inode_table_loc() returns) can be found by the output of dumpe2fs, as is the inode size. Once you find the block number and offset, you can use calculate the OFFSET used in the dd command above via:

OFFSET = (block * BLOCKSIZE) + offset

where block and offset is the values as calculated by do_imap.

You may want to practice seeing if you can properly replicate the calculation of do_imap by hand by practicing using dumpe2fs and then cross-checking with debugfs's imap command on your Linux system (assuming you can run Linux).

All of this being said, it might be useful to try compiling e2fsprogs from scratch for qnap, and then using debugfs built for qnap.

  • 1
    I just reached out to a qnap developer who had recently corresponded to me on the linux-ext4 mailing list. I pointed him at this question, and asked him if he could send a pointer to a copy of debugfs compiled for qnap. So you might want to hang on and wait for a bit and see if Kevin chimes in with something that might be safer and easier. Commented Oct 25, 2016 at 18:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .