Skip to contentSkip to conversation

Mapping sectors to have errors

DISCUSSION Yathindra 3 participants 6 messages Oct 28, 2011 – Nov 4, 2011 Device mapper

lore
Share & tools
lore

Yathindra

author
#0 lore raw

Hi,

I'm trying to create a disk and map some sectors to have errors on them.

I tried this,
echo "0 100000 linear /dev/sdb 0 100000 480081250 error"| dmsetup create bad_disk
device-mapper: reload ioctl failed: Invalid argument
Command failed

I have put in the right arguments but not sure why it fails.

Could someone please guide me how I can do this.

Thanks,
Yathi

#1 lore raw
Quoted 11 lines · Yathindra

Hi,

I'm trying to create a disk and map some sectors to have errors on them.

I tried this,
echo "0 100000 linear /dev/sdb 0 100000 480081250 error"| dmsetup create bad_disk
device-mapper: reload ioctl failed: Invalid argument Command failed

I have put in the right arguments but not sure why it fails.

You have 2 target lines concatenated onto the same line there.

author
#2 lore raw

Hi Joe,

I tried it the other way but when I specify error it doesn't seem to take the start sector > 0.

# echo "0 `blockdev --getsz /dev/sdb` linear /dev/sdb 0" | dmsetup create bad_disk
# dmsetup table
bad_disk: 0 488281250 linear 8:16 0
# echo "100000 488181250 error" | dmsetup load bad_disk << This failed
device-mapper: reload ioctl failed: Invalid argument
Command failed
# echo "0 100000 error" |  dmsetup load bad_disk << This worked

Any ideas?

Thanks,
Yathi

Quoted 13 lines · Joe Thornber
Quoted 11 lines · Yathindra

Hi,

I'm trying to create a disk and map some sectors to have errors on them.

I tried this,
echo "0 100000 linear /dev/sdb 0 100000 480081250 error"| dmsetup create bad_disk
device-mapper: reload ioctl failed: Invalid argument Command failed

I have put in the right arguments but not sure why it fails.

You have 2 target lines concatenated onto the same line there.

#3 lore raw
In reply to Yathindra
Quoted 6 lines · Yathindra

I'm trying to create a disk and map some sectors to have errors on them.

I tried this,
echo "0 100000 linear /dev/sdb 0 100000 480081250 error"| dmsetup create bad_disk
device-mapper: reload ioctl failed: Invalid argument
Command failed

Try
echo -e "0 100000 linear /dev/sdb 0\n100000 480081250 error"| dmsetup create bad_disk

Milan

author
#4 lore raw

Hi Milan,

It worked! Thanks so much ! :)

Have a great weekend.

Quoted 11 lines · Milan Broz
Quoted 6 lines · Yathindra

I'm trying to create a disk and map some sectors to have errors on them.

I tried this,
echo "0 100000 linear /dev/sdb 0 100000 480081250 error"| dmsetup create bad_disk
device-mapper: reload ioctl failed: Invalid argument
Command failed

Try
echo -e "0 100000 linear /dev/sdb 0\n100000 480081250 error"| dmsetup create bad_disk

Milan

author
#5 lore raw

Hi Milan,

I'm trying to inject random sector errors using device mapper.

Suppose I want to inject some 50 errors on random sectors, is their a way to do this without having to reload the table every time.

Thanks,
Yathi

Quoted 19 lines · Yathindra

Hi Milan,

It worked! Thanks so much ! :)

Have a great weekend.

Quoted 11 lines · Milan Broz
Quoted 6 lines · Yathindra

I'm trying to create a disk and map some sectors to have errors on them.

I tried this,
echo "0 100000 linear /dev/sdb 0 100000 480081250 error"| dmsetup create bad_disk
device-mapper: reload ioctl failed: Invalid argument
Command failed

Try
echo -e "0 100000 linear /dev/sdb 0\n100000 480081250 error"| dmsetup create bad_disk

Milan