[英]how to use dd to read and seek different block size
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
1)从给定的偏移量中读取3个块(自定义尺寸)2)需要使用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. 跳过512M的块,并使用256K的块从512M + 1偏移读取3个计数。
skip always should be in MBs and count blocks are variable. 跳过总是以MB为单位,并且计数块是可变的。 I am sure i am reading more data.
我确定我正在读取更多数据。 Can someone please correct me.
有人可以纠正我吗?
您始终可以将2 dd
s串在一起,第一个跳过,第二个读取您的实际数据:
dd if=a_Sparse_file_ofSIZe_1024M bs=1M skip=N | dd bs=262144 count=3
The count
parameter seems to be based on ibs
, so the obs
value does not matter here. count
参数似乎基于ibs
,因此obs
值在这里无关紧要。 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
. 因为您的
obs
值是ibs
,所以我建议设置bs=256K
然后将skip
值乘以四: skip=2048
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.