[dm-devel] Simulating faulty disk

Yathindra ydev at cs.utah.edu
Fri Oct 21 15:13:21 UTC 2011


 >mount -t ext3 /dev/sdb /mnt
Copied some data into /mnt
 >dmsetup create d0 --table="0 `blockdev --getsize /dev/sdb` delay 
/dev/sdb 0 500"
device-mapper: reload ioctl failed: Invalid argument
Command failed
 >umount /mnt
 > dmsetup create d0 --table="0 `blockdev --getsize /dev/sdb` delay 
/dev/sdb 0 500"
Worked.

Basically, am trying to test how regular userspace commands to 
read/write files
behave when I/O fails. For this, I need to put a file system and then 
carry on testing.

But as seen from above, dmsetup is failing to create a flakey/delay 
device when /dev/sdb
has a filesystem on top of it. Is there any workaround ?

Thanks,
Yathi

On 10/21/2011 9:00 AM, Yathindra wrote:
> Ok :)  Bryn is there a more elaborate document which shows simple 
> examples
> to work with device mapper. For a newbie like me it would be really 
> helpful.
>
> Thanks,
> Yathi
>
> On 10/21/2011 8:56 AM, Bryn M. Reeves wrote:
>> On 10/21/2011 03:47 PM, Yathindra wrote:
>>> dmsetup create d0 --table="0 `blockdev --getsize /dev/sdb` delay
>>> /dev/sdb 0 500"
>>> dmsetup create f0 --table="0 `blockdev --getsize /dev/mapper/d0` flakey
>>> /dev/mapper/d0 0 9 1"
>>> mkfs -t ext3 /dev/mapper/f0
>>> ...
>>> ...
>>> ext2fs_mkdir: Attempt to read block from filesystem resulted in short
>>> read while creating root dir
>>>
>>> Can we even mount such a device ?
>>
>> It's a flakey device :)
>>
>> With that table you'll have a device that is failing write I/Os for 
>> 1s in every ten. If that coincides with mkfs trying to write to the 
>> device it will create a corrupted file system.
>>
>> Depending on what you are trying to test you may want to put data on 
>> the device first.
>>
>> Regards,
>> Bryn.
>




More information about the dm-devel mailing list