Requirement
I want to write a file at various offsets into the partition
Partition /dev/part2 is mounted at /mypart
I tried the command below:
dd if=/dev/urandom of=/mypart/aaa bs=1024 seek=0 count=15000
dd if=/dev/urandom of=/mypart/aaa bs=1024 seek=15000 count=15000
dd if=/dev/urandom of=/mypart/aaa bs=1024 seek=30000 count=15000
Are they doing what I want to do? Are they writing a file to the partition at offset 0, 15000K and 30000K?
At what offset is the file written if I omit seek
from dd
dd if=/dev/urandom of=/mypart/aaa bs=1024 count=15000
Best Answer
You can't "write a file" at an "offset into the partition" using dd this way -- you are just writing data into a file named "aaa" within the mounted file system on that partition.
"seek=" will indeed cause dd to lseek to the given position before beginning its writes -- that means that it will simply create a file called /mypart/aaa and lseek the given number of blocks into that file before writing.
If you omit "seek=", dd will write starting at the beginning of the file named "aaa".