From owner-freebsd-questions Tue Oct 1 13:41:40 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7C87337B401 for ; Tue, 1 Oct 2002 13:41:38 -0700 (PDT) Received: from rwcrmhc53.attbi.com (rwcrmhc53.attbi.com [204.127.198.39]) by mx1.FreeBSD.org (Postfix) with ESMTP id BF0A543E75 for ; Tue, 1 Oct 2002 13:41:37 -0700 (PDT) (envelope-from swear@attbi.com) Received: from localhost.localdomain ([12.242.158.67]) by rwcrmhc53.attbi.com (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP id <20021001203924.JSP18767.rwcrmhc53.attbi.com@localhost.localdomain>; Tue, 1 Oct 2002 20:39:24 +0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by localhost.localdomain (8.12.5/8.12.5) with ESMTP id g91KgOMX005115; Tue, 1 Oct 2002 13:42:25 -0700 (PDT) (envelope-from swear@attbi.com) Received: (from jojo@localhost) by localhost.localdomain (8.12.5/8.12.5/Submit) id g91KgIc7005112; Tue, 1 Oct 2002 13:42:18 -0700 (PDT) (envelope-from swear@attbi.com) X-Authentication-Warning: localhost.localdomain: jojo set sender to swear@attbi.com using -f To: Mike Hogsett Cc: "Pranav A. Desai" , freebsd-questions@FreeBSD.ORG Subject: Re: how to use 'dd' to create image of a hard drive? References: <200209302345.g8UNjQZN049714@axp.csl.sri.com> From: swear@attbi.com (Gary W. Swearingen) Date: 01 Oct 2002 13:42:18 -0700 In-Reply-To: <200209302345.g8UNjQZN049714@axp.csl.sri.com> Message-ID: Lines: 59 User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Cuyahoga Valley) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Mike Hogsett writes: > Please anyone correct me if I am wrong, but I believe that when you are > using dd with a raw disk blocksize only effects performance and does not > have any effect on the duplicated data. That's what I've read, but I once had problems with "dd" handling the end of what I wanted to transfer. It might have been on Linux and it probably wasn't writing to a disk device, but ever since, I've been careful to try to use a "bs" which is an integer multiple or divisor of the device block size, if I know it (the disk driver apparently hides it here, whether the disk is "raw" or not) or an integer divisor of the device size. The default bs=512 never gives problems, but makes for slow transfers. I always make my partitions integer multiples of cylinder size (a debatably policy - see below) and I used the cylinder size as the "bs" last time I did this sort of thing. IIRC, I also did it using a bs equal to the size of the thing I was copying, determined from one or more of these: fdisk ad1 disklabel ad1 newfs -N ad1 Note that there is another set of conflicting terminology to consider. The "block size" (or "bsize") mentioned by "disklabel" and "newfs" are rather large FreeBSD things which "newfs" groups into larger things called "cylinders" and groups those into "groups". Those groups and cylinders are allowed to be cut short by the end of a partition (loosely speaking), and the "newfs" implies that it is giving you every last sector of the partition (ie, allowing the last block to be cut short -- don't let it's "unallocated" comment fool you), but I'm guessing that it really wastes up to one block (a small multiple of sector size) which I suppose can contain random data without harm (but I don't know). It seems clear that these blocks and cylinders can both can straddle the fictional (CHS-type) tracks and cylinders, so instead of sizing a partition as a multiple of track or cylinder size, it probably makes more sense to size it as a multiple of the expected newfs block size. (That is a function of the partition size, so unless you know the algorithm, trial and error might be needed to get it correct.) If you can get them both to come out even, you won't get the "*" marks from "disklabel" warning you about partitions not lining up with cylinders. Back to the original question: My current "/" device on ad0s2 was dd'd from ad0s4 and "disklabel ad0s2" shows: # /dev/ad0s2c: type: ESDI disk: ad0s4 Apparently, the erroneous disklabel (showing s4, not s2) is harmless. P.S. to Mike: Please don't quote so much stuff which you don't refer to. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message