如何使DU命令投入输入/输出错误
如何制作du
命令投掷输入/输出错误
。由于某种原因,我想复制此用例,并想在更改推向生产之前验证我的修复程序。我无法理解如何重现此用例。我尝试了很多事情,但没有运气。任何其他命令也可以罚款文件系统输入/输出错误。
例如
du -sh /data/
du: cannot access '/data/': Input/output error
How to make du
command throw input/output error
. For some reason, I want to reproduce this use case and want to verify my fix before changes pushed to production. I am not able to understand how to reproduce this use case. I tried so many thing, but no luck. Any other command also fine which throws input/output error for file system.
E.g.
du -sh /data/
du: cannot access '/data/': Input/output error
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
The error message appears to be EIO. man page
in-turn,
那么,那留给你的地方呢?好吧,您需要以某种方式模拟从syscall接收eio。您应该能够使用Strace为了使任意的syscall返回eio ,但是哪一个?
首先在Strace下运行
DU
,以查看哪些SYSCALL可能返回EIO。 FSTAT(2)不会在Linux上返回EIO,因此必须是另一个Syscall。The error message appears to be EIO. The man page says
In-turn, POSIX says:
So, where does that leave you? Well, you need to somehow simulate du receiving EIO from a syscall. You should be able to use strace to make an arbitrary syscall return EIO, but which one?
Start by running
du
under strace to see which syscalls might return EIO. fstat(2) does not return EIO on Linux, so it must be another syscall.