Question : dd count=1 bs=4k skip=31 seek=1 if=/lv01 of=/lv01

What is exactly this command doing?
I understand:
count=1 --> once
bs=4k --> by 4k of block size

skip=31  --> skipping which/what from outer or inner ??
seek=1  --> seeking 1 of which/what ??

Answer : dd count=1 bs=4k skip=31 seek=1 if=/lv01 of=/lv01

The term "block" refers to the quantity of data read or written by the dd command in one operation. The dd command is usually used to access raw data or I/O and thus needs to know the block size to use. Most of the other parameters of the dd command are expressed in number of blocksize. So it is important to understand the data you are accessing, because the read and write operations will be done using the block size you specify. The block size may be specified for:
 - both input and output file (with bs parameter)
 - input file only (with ibs parameter)
 - output file only (with obs parameter)

Some parameters are targeted to:
 - both input and output file (e.g. noerror)
 - input file only (e.g. skip)
 - output file only (e.g. seek)

For the parameter your command use, if you have a look a dd's man page, you will read:
 - if=InFile Specifies the input file name; standard input is the default.
 - of=OutFile Specifies the output file name; standard output is the default.
 - bs=BlockSize Specifies both the input and output block size, superseding the ibs and obs flags. The block size values specified with the bs flag must always be a multiple of the physical block size for the media being used.
 - count=InputBlocks Copies only the number of input blocks specified by the InputBlocks variable.
 - skip=SkipInputBlocks Skips the specified SkipInputBlocks value of input blocks before starting to copy.
 - seek=RecordNumber Seeks the record specified by the RecordNumber variable from the beginning of output file before copying.

When accessing raw data, it is possible to use different block size as long as we clearly understand the underlying data. So, forexample, we could rewrite your command:
dd count=1 bs=4k skip=31 seek=1 if=/lv01 of=/lv01

like this:
dd count=4 bs=1k skip=124 seek=4 if=/lv01 of=/lv01

Those two commands will have the same effects, but the way dd will work internally will be different.
For the first command, dd will read 1 block of 4k from /lv01 starting at block 31 and write that block to /lv01 starting at block 1.
For the seconnd command, dd will read 4 block of 1k from /lv01 starting at block 124 and write that block to /lv01 starting at block 4

If you want to see for yourself try the following:
# dd if=/dev/lv01 of=/tmp/test4k bs=4k count=1 skip=31
1+0 records in.
1+0 records out.
# dd if=/dev/lv01 of=/tmp/test1k bs=1k count=4 skip=124
4+0 records in.
4+0 records out.
# diff /tmp/test4k /tmp/test1k
#
Random Solutions  
 
programming4us programming4us