When using "dd", you need to be very careful how you not only write it out but also how you read it out.
So for example, lets say I have an output from disklabel as such as: ======================================================================== ======== 16 partitions: # size offset fstype [fsize bsize cpg] a: 819441 63 4.2BSD 2048 16384 328 # (Cyl. 0*- 812) b: 819504 819504 swap # (Cyl. 813 - 1625) c: 156301488 0 unused 0 0 # (Cyl. 0 - 155060) d: 4194288 1639008 4.2BSD 2048 16384 328 # (Cyl. 1626 - 5786) e: 150463089 5833296 4.2BSD 2048 16384 328 # (Cyl. 5787 - 155055*) ======================================================================== ======== And I want to rip out just "a" to write to another disk. First, its imperative to have the fdisk setup correctly, though for a flash device, creating a whole partition on 3 works well, (fdisk -e sd0, e 3, A6, follow prompts). Once you've got your partition created, remember to dd out the first 63 sectors along with the size of the partition. So you'd do "dd if=/dev/wd0 bs=512 of=wd0a.img count=819504" and write it out with "dd if=wd0a.img of=/dev/sd0c". There's some debate on which works better, using the "raw" device (rsd0c) or the "character" device (sd0c) but I've always used the character and not raw device without failure on all my machines I've done this too. To copy out the "d" partition for example, its as simple as doing "dd if=/dev/wd0 of=wd0d.img bs=512 skip=1639008". The "skip" flag size is calculated by looking at the size of a+b+63 (63 being the initial offset of "a"). Hope this helps clear up some things. Also, "bs=512" isn't needed, I just use it in my scripts to tell other people who may use it later that the default blocksize is 512 in case they're not clued up enough to know this. Regards, Mike Lockhart =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Mike Lockhart [Systems Engineering & Operations] LodgeNet StayOnline, Inc http://www.stayonline.net/ mailto: [EMAIL PROTECTED] GPG: 8714 6F73 3FC8 E0A4 0663 3AFF 9F5C 888D 0767 1550 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gordon Turner Sent: Tuesday, March 13, 2007 2:44 PM To: [EMAIL PROTECTED] Cc: OpenBSD misc mailing list Subject: Re: dd questions On Tue, 13 Mar 2007 20:11:24 +0200, [EMAIL PROTECTED] wrote: > On Tue, Mar 13, 2007 at 01:31:53PM -0400, Gordon Turner wrote: >> I have three questions for the dd savants out there, consider an image > being dd'd that is created with a dd statement like: >> >> dd if=/dev/zero of=imageFileName.img bs=512 count=1014049 > > It's quite silly to fill up your disk will zero bytes. Use this instead: > > dd if=/dev/null of=imageFileName.img bs=512 seek=1014049 Excellent point, thanks. >> Question 3. Writing the image at 'bs=512' can take a looong time, is > there any risk of corruption with using 'bs=20m' instead, or will this > mess up the output? > > I don't think so. Thanks, that will help speed up my iterations and eliminate this step as a source of problems. I was under the impression that as long as was a multiple of 512, it would be okay? -- http://www.gordonturner.ca