Use Linux dd to copy and read file at specified location
5,750
You may use this one to seek bytes
(2099199*512)
not bs
count.
dd if=your.txt of=/dev/sdb count=1 bs=150 oflag=seek_bytes seek=1074789888
and
dd if=/dev/sdb of=your.txt count=1 bs=150 iflag=skip_bytes skip=1074789888
See man dd
.
Then what about:
dd if=your.txt of=/dev/sdb bs=1 count=150 seek=1074789888
and
dd if=/dev/sdb of=your.txt bs=1 count=150 skip=1074789888
Related videos on Youtube
Author by
ncheltsov
Updated on September 18, 2022Comments
-
ncheltsov over 1 year
I want to use the
dd
command to write one file at any location of the hard drive and then to read the same file from this location. I need to be independent on any file system or partitioning. It seems not easy to do this. The prerequisites are:- In order to do this I need to be able to navigate on the hard drive. The compass would be the sectors, let's say 1 sector = 512 B.
- The file size is, let's say 150 B. Simple text file.
- I want to write this file starting from 2099200 sector.
I tried this:
sudo dd if=my.txt of=/dev/sdb obs=512 seek=2099199 sudo dd if=/dev/sdb of=my.txt obs=150 count=1 ibs=512 skip=2099199
but it is not working because I can not make it read only 150 B, because of the
ibs
count which is 512 B. I need this count in order to easily navigate on the hard drive so it must be 512 B.Is there an easy way to handle this case with
dd
? Or maybe there is another command or way to do this? I need to be independent on any kind of file systems and partitioning. -
ncheltsov over 10 yearsunfortunately my version of dd seems not having this flags.