Need Help with commands to automate.

HI,

In some test cases, I used tools like "dd" and "shed" to manually read a block from the disk, modify it using a hex editor and write it back using "dd".
I need help with some linux commands I can use to read the block and change the data to induce the corruption....as I want to automate my test case.

Thanks In Advance,
Prince Sharma

---------- Post updated at 05:39 AM ---------- Previous update was at 05:09 AM ----------

Test Scenario is like :
h)Using dd, copy out the contents of an EA block into a file.
i)Using shed editor, edit the contents at the offset 0004 to 00 instead of 01. This corrupts the EA header ref count.
j)Using dd, write back the contents of the modified block .

Plesae help me.

---------- Post updated at 06:29 AM ---------- Previous update was at 05:39 AM ----------

I do this to get a file with dumb block data.

dd bs=4096 skip="block number"  count=1 if=/dev/ivg2/ilv2 of=yy.out

Please help me with some shell command which I can use to read the dumb block data and modify it.

Well, what do you want to do to it?

Well, the output from the dd comand is a binary file and i want to modify a value 01 at offset 0004 to 00.

You can read a byte 00 from /dev/zero. Set the blocksize to 1 and dd can overwrite the specified 'block' in that file without shrinking or overwriting it otherwise(seek to skip forward in output, conv=notrunc to not shrink the file to 5 bytes)

dd if=/dev/zero of=blockfile bs=1 count=1 seek=4 conv=notrunc