From owner-freebsd-questions@FreeBSD.ORG Sun Dec 2 01:53:44 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21CA016A41A for ; Sun, 2 Dec 2007 01:53:44 +0000 (UTC) (envelope-from mike.jeays@rogers.com) Received: from smtp102.rog.mail.re2.yahoo.com (smtp102.rog.mail.re2.yahoo.com [206.190.36.80]) by mx1.freebsd.org (Postfix) with SMTP id DE0E413C43E for ; Sun, 2 Dec 2007 01:53:43 +0000 (UTC) (envelope-from mike.jeays@rogers.com) Received: (qmail 65496 invoked from network); 2 Dec 2007 01:53:43 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=rogers.com; h=Received:X-YMail-OSG:From:To:Subject:Date:User-Agent:References:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-Disposition:Message-Id; b=DBp8L4737cpyHH0HAKejfOCtp+HDTjeADdzCvSkLwsiN742136HKMaJvUCXxen4C6Rv1SdR7omCGjUjXw0+gHin6Ls/2Z8AQsO3n2pilojeOABrp0M5SJIDX1GtztufJ2O5nY0sZqqh+5krAA/krzjYhMCGedoo1HttqGWAtGd8= ; Received: from unknown (HELO napoleon.local) (mike.jeays@rogers.com@99.224.73.40 with login) by smtp102.rog.mail.re2.yahoo.com with SMTP; 2 Dec 2007 01:53:42 -0000 X-YMail-OSG: E7C7XOMVM1n43ZC6r_4EZqfI.PDc_SG4oyGCLxNIFiuCygXqzjwkBTalYQ_H0k84wA-- From: Mike Jeays To: freebsd-questions@freebsd.org Date: Sat, 1 Dec 2007 20:53:41 -0500 User-Agent: KMail/1.9.6 (enterprise 0.20070907.709405) References: <539c60b90712010929m7fef7020v806eb3c1eb24d066@mail.gmail.com> <4751C1EF.4010206@daleco.biz> In-Reply-To: <4751C1EF.4010206@daleco.biz> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200712012053.41426.mike.jeays@rogers.com> Subject: Re: using dd to duplicate disks/partitions of slightly different sizes - works? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Dec 2007 01:53:44 -0000 On December 1, 2007 03:19:59 pm Kevin Kinsey wrote: > Steve Franks wrote: > > I've got two 160GB disks. Different manufacturers, so different # > > bytes. One is FreeBSD, the other blank. I'd like to backup my system > > for the fastest possible recovery after a crash - move the plug and > > power up. I have gmirrored before, but I just wanted to do a quick > > dd, since I don't want to abuse my cheapo powersupply (has 4 disks > > already on it). > > > > Two questions: > > > > (1) If I dd from the smaller to the larger, will it work? What > > happens to the extra, say 5MB of unused space - will my partition info > > be messed up? > > > > (2) If I dd from the larger to the smaller (df reports only 50% used > > anyway) is there a way to make sure there is no info in the 5MB at the > > end that will overflow the smaller, and again, will my partitions be > > ok? > > > > The other option is just to fdisk & label the other disk, then rsync > > everything to it. Is that the wiser choice? > > > > Thanks, > > Steve > > Giorgos Keramidas made a great post dealing with this > a while back. Here 'tis, quoted for your enjoyment > and potential enlightenment (also quoted is Martin > McCormack): > > ----------------------------------------------- > > >> It turns out that dd defaults to 512-byte blocks so I didn't > >> really need the bs=512, but I am not sure I haven't made some other > >> type of mistake. The dd command has been running for about 4 hours on > >> a very fast system, with a 1-gig processor, 1 gig of RAM and two 31-GB > >> drives. One would think it should have finished by now, but it is > >> still running. Is this a valid method of copying the entire contents > >> of one drive to another? Thank you. > > Bah! That's too slow for my taste. I would usually go for a newfs, > dump, and restore option. For instance, to create a copy of /usr on a > second disk: > > newfs -U /dev/ad1s1a > mount /dev/ad1s1a /mnt > dump -0 -a -L /usr | ( cd /mnt ; restore ruvf - ) > > Copying with dd(1) is not as fast :) > ------------------------------------------ > HTH, > > Kevin Kinsey I tried using dd with two 80GB disks, using a much larger block size (512M), booting Knoppix to make sure the filesystems on the 'input' disk were quiescent. It worked, but took an amazing 14 hours, which is only about 1.5 Mb/sec. The 'output' drive was on an IDE connector shared with the CD device, so that may have been a cause of the poor performance. Anyway, read 'man dd'. You can specify very large blocksizes. I suspect it might take very many hours with a blocksize of 512. -- Mike Jeays http://www.jeays.ca