Reputation: 749
I have a situation where i have to read sparse file. This file is having data at specific offset. Now i want to achieve. 1) Read 3 blocks(custom sizes) from the given offset 2) offset need to be seek using 1M
So, i am trying below command but not successful. I am reading more contents for sure.
dd if=a_Sparse_file_ofSIZe_1024M of=/dev/null ibs=1M skip=512 obs=262144 count=3
skip 512M of blocks and read from 512M+1 th offset using block of 256K for 3 counts.
skip always should be in MBs and count blocks are variable. I am sure i am reading more data. Can someone please correct me.
Upvotes: 1
Views: 2172
Reputation: 207425
You can always string 2 dd
s together, the first one to skip and the second one to read your actual data:
dd if=a_Sparse_file_ofSIZe_1024M bs=1M skip=N | dd bs=262144 count=3
Upvotes: 3
Reputation: 13304
The count
parameter seems to be based on ibs
, so the obs
value does not matter here. As your obs
value is four times smaller than ibs
, I would suggest to set bs=256K
and just multiply skip
value by four: skip=2048
.
Upvotes: 1