Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 May 2006 17:36:46 -0500
From:      Andrew <andrew.chace@gmail.com>
To:        "Chad Leigh -- Shire.Net LLC" <chad@shire.net>
Cc:        FreeBSD Questions Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: "dd" question
Message-ID:  <1146695806.3352.14.camel@LatitudeFC5.network>
In-Reply-To: <E573EA60-5542-475C-A112-A7360575CC89@shire.net>
References:  <E573EA60-5542-475C-A112-A7360575CC89@shire.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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
	




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1146695806.3352.14.camel>