dd cloning a Win 10 HDD to SSD

rixter rixter at rixtertech.com
Tue Mar 23 19:17:21 EDT 2021


I wrote this back when the world was much younger. I hope I haven't
stepped on anyones' toes by posting such a fat file, all 6k.  Since
it's so old the benchmarks should be way off but I doubt the command
line info has changed much if at all. I hope it inspires some ideas, I
used to use those commands when building FAX/paging servers for call
centers.  ...Back to lurking...


RCM Aug 10 '06

CLONING DRIVES WITH LINUX		
==========================

To ghost to a drive (clone, if you will) of the same size or larger:

 EIDE: sudo dd if=/dev/hda of=/dev/hdb
 SATA: sudo dd if=/dev/sda of=/dev/sdb

A Debian 3.1 system was able to clone its 80 gig SATA drive to another
SATA drive in 98 minutes
of realtime, reporting 20 minutes of system time used for the process,
while simultaneously functioning
as a fax/paging engine and supporting SSH logins and file transfers.


Ghost a partition to another partition:

 sudo dd if=/dev/hda1 of=/dev/hdb1

Create an image on a drive that you have locally mounted as /mnt/images:

 sudo dd if=/dev/hda of=/mnt/images/backup050824.img


The following example uses sdd instead of dd and adds a call to pv for
a progress display.
If you need to use it on a knoppix system use dd and remove the '-'
from the '-bs=1024k' statement.
A Debian system stored its 80g drive to a 13g compressed image file in
93 minutes with this command line.

Create a gzipped image file of an 80g SATA drive on a locally mounted
IDE drive, with progress display:

sdd if=/dev/sda -t -bs=1024k|pv -s 80g -r -b|gzip -c
-9>/mnt/hdc1/pinnfax-1.05-060208.imz


Create an image across an SSH pipe:

 sudo dd if=/dev/hda | ssh somevaliduser at 10.0.0.69
"cat>/mnt/hugedrive/bigbackup.img"

Create a compressed image across an SSH pipe:

(-c says send to stdout; -9 says use max compression)

 sudo dd if=/dev/hda | ssh someuser at 10.0.0.69 "gzip -c
-9>/mnt/fatdrive/bbbackup.gz"

Duplicate a drive across an SSH pipe:

Note: In doing this with the target machine booting knoppix 3.91 from
CD-ROM, I had to use root as the user.

 sudo dd if=/dev/hda | somevaliduser at 10.0.0.69 "cat>/dev/hda"

A more specific example, adding pv to show a progress meter, required
3 hrs 15 minutes for an 80 gig drive.

 dd if=/dev/sda |pv -s 80g -r -b|ssh root at 10.0.0.51 "cat>/dev/sda"

Dupe to a compressed image across SSH with the 'pv' progress meter running.

 dd if=/dev/hda |pv -s 15g -r -b|ssh faxuser at 10.0.0.245 "gzip -c
-9>/somedir/debian-051017img.isz"

The prior command line stored an 80 Gb drive with approx 5 gigs of
data to a 4 Gb file.  Drives with more data would of course yield less
extreme ratios.


Duplicate a drive while compressing on the fly to limit LAN bandwidth needed:

Note in this case the '/dev/sda' denotes a serial ATA drive.  The source was
a Debian system, the target an unformatted system botting Knoppix on which
a root passwd had been previously set up by invoking su to root and then
passwd to set a password.  We compress before sending out with gzip, and then
uncompress before writing with zcat. Note also that if you're in a hurry, this
is not the method for you.

 sudo dd if=/dev/sda|gzip -c -9|ssh root at 10.0.0.41 "zcat|dd of=/dev/sda"

Duplicate a drive, piping through the PV progress meter, compressing
on the fly, across an SSH pipe using the Blowfish algorithm to
increase throughput.

dd if=/dev/hde bs=512k|pv -s 160g -r -b|gzip -c -9|ssh -c blowfish
faxuser at 10.0.0.41 "cat>/mnt/hdc1/debcti-v1.00-060213.imz"

This prior command line was able to store an image of a 160 gig drive
across the network in 66 minutes on a fast 2.8 GHz Intel Xeon board to
a 13 gig file, with both source and target machines running Debian..

Restore a compressed image across SSH:

Boot Knoppix on target, start service SSH.  On Target machine, su to root
and invoke passwd.  Set password to knoppix.  Drive must be same size or
larger as source.

 dd if=debian-051017img.isz|ssh root at 10.0.0.57 "zcat|dd of=/dev/hda"

Note that zcat (or gunzip if you'd rather) is run on the target before
piping to DD instead of at the source drive.  This limits the network
traffic needed to transport the image.  The combination of compressed
images and end-point decompression is the fastest and most efficient
way I've found to serve a ghost image to a target drive without resorting
to special software.  A 13g compressed image restores to an 80g drive in
about 90 minutes or less.

In some cases this method appears to be a faster way to restore when
network bandwidth is not an issue.  The source image is expanded on
the image server and then sent across the network requiring vastly
more bandwidth.

zcat ./cti-mb.intel.se7520jr2-v0.30-060331.imz|pv -s 2g|ssh
root at 10.0.0.68 "dd bs=8192k of=/dev/sda"


Here are some command lines to expand later, to describe writing to a
secondary drive on a system for which
we cannot set up incoming root log ins through SSH.

11:34:11 root at pinnfax:~# scp
rixter at 10.0.0.64:/mnt/hdc1/pfx-deb-etch-aidan-v2.50-090304.bz2
./pfxpipe

11:34:14 root at pinnfax:~# dd if=/root/pfxpipe|bzcat|dd bs=4096k of=/dev/sdb

11:46:43 root at pinnfax:~# ps aux |grep "of /dev/sdb"
root     23332  1.1  0.0   6992  1916 pts/2    S+   11:34   0:08 dd bs
4096k of /dev/sdb
root     10438  0.0  0.0   2848   704 pts/3    R+   11:46   0:00 grep
of /dev/sdb

11:45:17 root at pinnfax:~# watch -n 60 kill -USR1 23332




ADDENDUM: SSH SERVICES WITH KNOPPIX
===================================

To start an SSH server:

Preferred Method:

Boot the system with your Knoppix CD and at the boot prompt type
'knoppix 2' to cause the system to come up in single-user mode.
su to root and type passwd.  Choose a password and enter it twice.
Now invoke '/etc/init.d/ssh start' to start the SSH service.

OR

Boot the system using your Knoppix CD.  After it has come up, click on the
Knoppix penguin on your bottom menu bar.  Select 'ROOT SHELL' and when your
shell appears onscreen, select it and type 'passwd' <enter>.
Enter a simple password and hit <enter>.  Do it again to confirm.
Now click on the penguin again.  Mouse to Services and click
on 'Start SSH Server'.  You may now SSH to this machine from elsewhere on
the LAN and you may access the root account while doing so.
Be careful.

Whichever method you choose, now type 'ifconfig' <enter> and make note of
the IP address of this machine, usually on eth0.  The address will be preceded
by the string 'Inet addr:'.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.gnhlug.org/pipermail/gnhlug-discuss/attachments/20210323/036a3efd/attachment-0001.html 


More information about the gnhlug-discuss mailing list