Score:0

How to simulate faulty disks in Ubuntu 20?

cn flag

For debugging purposes, I'd like to simulate the following states regarding disk drives on my VM with Ubuntu 20:

  1. disk is missing/offline
  2. disk is faulty
  3. disk is not responding

While I could quickly solve the first one but removing the disk from the VM setup, the second and third one are a bit harder to simulate.

I tried with the approach found here, but it seems that either there is some info missing here that additionally needs to be loaded/installed, or the procedure has changed since the date of writing. When I try to do something like

echo 1 > /sys/block/sdb/make_it_fail

I get:

-bash: /sys/block/sdb/make_it_fail: Permission denied.

Also, the folder /debug/make_fail_request is not created for me. It seems like there needs to be done to get this working on a recent kernel.

My second try was with the package "fiu-utils", but I can't find any info about how to use if for drives.

Is there any working approach for Ubuntu 20?

ChanganAuto avatar
us flag
#1 is trivial: Add a drive, create mount point, remove drive.
jtessier72 avatar
cn flag
The link where you say you're following an approach is broken. Is it simply because you aren't a user with permissions to do it? Try sudo bash and then your echo command or something similar to echo 1 | sudo tee /sys/block...
ChrisTG74 avatar
cn flag
@ChanganAuto: Yes, I already solved that case (see my text).
ChrisTG74 avatar
cn flag
@jtessier72: I did everything as root user, nonetheless the permission denied occurs.
jtessier72 avatar
cn flag
Your link is still broken (links to https://lxadm.com/using-fault-injection/here - remove the here) , but the article I think you wanted to link to says: "You need fault injection and debugfs compiled in the kernel." Is this in place?
jtessier72 avatar
cn flag
This might help too: https://stackoverflow.com/questions/1361518/how-can-i-simulate-a-failed-disk-during-testing
ChrisTG74 avatar
cn flag
@jtessier72 that's exactly the article where I found the link I posted above. I have no idea if Canocial added debugfs and fault injection support in their kernels. That's why I posted by question here :-)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.