![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| server seek internet | ariec | AIX | 0 | 06-05-2008 12:20 AM |
| Add faceted search to Thunderbird with Seek | iBot | UNIX and Linux RSS News | 0 | 04-21-2008 01:50 AM |
| seek-1f42 1.46 (Default branch) | iBot | Software Releases - RSS News | 0 | 03-19-2008 05:30 PM |
| seek-h262 4.84 (Default branch) | iBot | Software Releases - RSS News | 0 | 02-02-2008 08:40 PM |
| Why script For...Loop doesn't work. Seek help | duke0001 | UNIX for Dummies Questions & Answers | 3 | 10-16-2006 01:22 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
dd seek problem
I want to seek to a location on the hard drive that will be written to that is different from the output block size. Is this possible? It seems the man page implies you can only seek in increments of the number of bytes you output.
A bit of information about what I'm trying to do, if that helps. Maybe I need to use another unix command I don't know of: I'm trying to do is to seek to a point on a hard drive and write to it in block sizes that will not page. So, if I seek to a point on the hard drive that is larger than my ram, that would be the default block size to write, then I believe I will get paging. Last edited by silvermoon; 08-29-2008 at 09:42 AM. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
You can seek to any point with dd, it's not tied to the hardware's block size; you can set bs to anything (for example, one).
I don't understand your explanation of why you think this would be useful, though. |
|
#3
|
|||
|
|||
|
Quote:
What I find is confusing is that dd man page seems to imply I can only seek in obs. Which makes it seem that if I decide I want to write with a megabyte at a time (so do more per count iteration), I can only seek a megabyte at a time, which results in not being able to seek any where I want. I hope I'm confused, because dd won't work for me if this is true. Unless there is a workaround. |
|
#4
|
|||
|
|||
|
I think your interpretation of "seek" is wrong. It means to skip to the requested position.
Code:
vnix$ time dd if=/dev/zero bs=9876542 seek=42 count=1 of=/dev/null 1+0 records in 1+0 records out 9876542 bytes (9,9 MB) copied, 0,000559297 seconds, 17,7 GB/s real 0m0.206s user 0m0.004s sys 0m0.004s You are correct that the seek parameter expresses how many blocks to seek forward, but on a block device, this truly is a seek operation (move the disk head to the requested position), not a serial operation. Of course, if you mean to read a lot of data after the seek operation, then the block size does affect the read, but I don't think it modifies the hardware buffer block size, i.e. slow down buffered reads. Last edited by era; 08-31-2008 at 08:23 AM. Reason: On reading after seeking |
|
#5
|
|||
|
|||
|
Quote:
I used a jpg to copy to make it easy to check for errors. I copied the file to a usb memory stick with no partition table, (zeroed out). First I tried without seeking or skipping and all worked fine. The jpg opened fine. Code:
x@hugin:~$ sudo dd if=/home/x/Desktop/omp.jpg of=/dev/sdb count=1 ibs=281881 1+0 records in 550+1 records out 281881 bytes (282 kB) copied, 0.740358 seconds, 381 kB/s x@hugin:~$ sudo dd if=/dev/sdb of=/home/x/Desktop/p.jpg count=1 ibs=281881 1+0 records in 550+1 records out 281881 bytes (282 kB) copied, 0.493491 seconds, 571 kB/s Code:
x@hugin:~$ sudo dd if=/home/x/Desktop/omp.jpg of=/dev/sdb seek=1 count=1 ibs=281881 1+0 records in 550+1 records out 281881 bytes (282 kB) copied, 0.722257 seconds, 390 kB/s x@hugin:~$ sudo dd if=/dev/sdb of=/home/x/Desktop/p.jpg skip=1 count=1 ibs=281881 1+0 records in 550+1 records out 281881 bytes (282 kB) copied, 0.48324 seconds, 583 kB/s |
|
#6
|
|||
|
|||
|
Can you examine the resulting file? I assume you get the result from the first experiment in the first 281,881 bytes after the second operation, and its contents are 2 x 281,881 bytes (but of course, in the absence of a file system, it's hard to tell). What about when you copy it back, do you get padding on either end of the file, or the wrong number of bytes, or the wrong contents?
|
|
#7
|
|||
|
|||
|
Quote:
I finally realized that default 550 obs was the issue when combined with skip, whereas seek used 281881. The program I'm writing is in Python. My goal is to write a file at any location I want on any drive. It's part of an encryption idea, where the encryption decides where to store the file rather than the file management system. That's when I need to seek a number of bytes that isn't the ibs. I'm not sure the dd is going to help me with this. But I can't say that with full confidence, because I don't fully understand how it works yet. |
|||
| Google The UNIX and Linux Forums |