From: Andi Kleen <andi@firstfloor.org>
To: linux-xfs@vger.kernel.org
Subject: IO error handling in xfs_repair
Date: Thu, 26 Jun 2025 23:56:44 -0700 [thread overview]
Message-ID: <aF5ArCN0M9940yK7@firstfloor.org> (raw)
Hi,
I have a spinning disk with XFS that corrupted a sector containing some inodes.
Reading it always gave a IO error (ENODATA).
xfs_repair unfortunately couldn't handle this at all, running into this
gem:
if (process_inode_chunk(mp, agno, num_inos, first_ino_rec,
ino_discovery, check_dups, extra_attr_check,
&bogus)) {
/* XXX - i/o error, we've got a problem */
abort();
}
TBH I was a bit shocked that XFS repair doesn't handle IO errors.
Surely that's a common occurrence?
Anyways, what I ended up doing was to use strace to get the seek offset
of the bad sector and then write a little python program to clear the block
(which then likely got remapped, or simply rewritten on the medium),
and apart from a few lost inodes everything was fine.
It seems that xfs_repair should have an option to clear erroring blocks that
it encounters? I realize that this option could be dangerous, but in many cases
it would seem like the only way to recover.
Or at a minimum print the seek offset on an error so that it can be cleared manually.
-Andi
next reply other threads:[~2025-06-27 7:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <RqbhOWAnTss1XJ3HuLRM056kHzvQab82moL4vq9btD1T0gH6JOPtM2N97utM_IQ1fwl65CM4Qoo90BmpcE7mJg==@protonmail.internalid>
2025-06-27 6:56 ` Andi Kleen [this message]
2025-06-27 19:24 ` IO error handling in xfs_repair Carlos Maiolino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aF5ArCN0M9940yK7@firstfloor.org \
--to=andi@firstfloor.org \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox