"dd" question
Andrew
andrew.chace at gmail.com
Wed May 3 22:38:30 UTC 2006
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
More information about the freebsd-questions
mailing list