From owner-freebsd-questions@FreeBSD.ORG Wed May 3 22:38:30 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org 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 C2A1216A402 for ; Wed, 3 May 2006 22:38:30 +0000 (UTC) (envelope-from andrew.chace@gmail.com) Received: from nz-out-0102.google.com (nz-out-0102.google.com [64.233.162.205]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4390A43D4C for ; Wed, 3 May 2006 22:38:29 +0000 (GMT) (envelope-from andrew.chace@gmail.com) Received: by nz-out-0102.google.com with SMTP id i11so300801nzi for ; Wed, 03 May 2006 15:38:29 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:subject:from:to:cc:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding; b=q7lQ13yFEVIcog/Gn2GuoWVcM47MFZKH+WwTZdFwIgUHYESFsSQ3ih0Neyn1oZSADOwLSITsuQcg+lHojmmdgu0nPAy26MYcoO66cJ7eb3xN0RQvYMK7KsyuoAsNSadP1ofAcCKfuWq+u/99ARONV+hSeyYvbtgb6CFTLVfmJlA= Received: by 10.36.129.3 with SMTP id b3mr352637nzd; Wed, 03 May 2006 15:38:29 -0700 (PDT) Received: from ?192.168.0.6? ( [70.56.4.48]) by mx.gmail.com with ESMTP id 37sm1634609nzf.2006.05.03.15.38.27; Wed, 03 May 2006 15:38:27 -0700 (PDT) From: Andrew To: "Chad Leigh -- Shire.Net LLC" In-Reply-To: References: Content-Type: text/plain Date: Wed, 03 May 2006 17:36:46 -0500 Message-Id: <1146695806.3352.14.camel@LatitudeFC5.network> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 (2.6.1-1.fc5.2) Content-Transfer-Encoding: 7bit Cc: FreeBSD Questions Mailing List Subject: Re: "dd" question 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: Wed, 03 May 2006 22:38:30 -0000 On Wed, 2006-05-03 at 14:11 -0600, Chad Leigh -- Shire.Net LLC wrote: > I have a Windows machine that also has some linux partitions. lilo > is the main boot manager. Can I used dd from my freebsd box to > completely copy the whole disk, partition tables and all, to another > disk? The disk in the machine is starting to appear to be a little > flaky and I have another of the same mechanisms here and would like > to just basically clone the whole thing over. I seldom use the > machine but when I do need it I need it (tax time, an old website > that uses a specific windows tool for updating, etc) > > Thanks > Chad I've done this several times, and it works reasonably well. Someone recommended piping the output through netcat, which will work; however I have another suggestion. If you think the disk will be ok, use dd to "zero-out" the rest of the drive; i.e. dd if=/dev/zero of=zeros; rm zeros; dd if=/dev/ad0 of=- | gzip - - | nc $HOSTNAME $PORT; I've always used FTP instead of netcat, but you should be just fine. netcat may even be a bit faster, since you don't have the overhead of the FTP protocol. On the receiving end, just do the reverse: nc -l $PORT | gzip -d - - | dd if=- of=/dev/ad0; You can play around with blocksize too; sometimes it will speed up the process a little bit. One of these days, I am going to write a tool to do just this sort of thing, since it seems to be a fairly common practice. -Andrew