5 years ago
My life in code and photos recently approached half a Terabyte, the limit of my
USB external drive. Now with an HD dashcam the brink was in sight, so I
purchased a 3TB drive on sale at Fry's for $80. I wanted a bit for bit duplicate
of the old drive on the new one.
My first concern was the new drive is USB 3.0 and the old drive was 2.0. Not to
worry, that just means the 2.0 will be the slowness in the bottleneck factoring.
They are perfectly compatible in the eyes of the Pi and most other controller
devices. USB 3.0 is an investment in the future. This 3TB drive is my first USB
3.0 device. It powers solely from the Pi3+ and the Pi Zeros will be able to
connect with OTB to OTB USB cable (and my Android phone and dashcam dump)
according to plan, just not as fast as the drive is able.
An other concern was transfer software, what would make an identical copy?
Several answers were researched on the Google query "bit for bit disk copy"
later refined to "bit for bit disk copy in Linux command line". The simplest and
most powerful choice was the linux console command:
dd if=/dev/sdb of=/dev/sda &
See $> dd --help for details
dd, disk duplicate
if, input file, or other source in this case the unmounted b drive
of, output file, or other destination in this case the unmounted a drive
the drives were determined by order of attachment and the names were determined
by the command line 'fdisk ?l'
Which suited me fine as my Win PC is heavily burdened with other tasks and my
two Puppy Linux laptops are busy loaded with hundreds of SeaMonkey browser
pages, which tend to spike the processor load, locking up keyboard and mouse and
occasionally requiring manual restart - too flaky for the immediate task at
hand. However, there are two unburdened Raspberry Pi Zeros waiting for an
assignment and a Faspberry Pi 3+ running background CHRON scripts and finishing
up an online class 'Teaching Physical Computing with Raspberry Pi and Python'
from Raspberry Pi Foundation on FutureLearn.com and SSH in from the Puppy to the
Pi3 was the best choice, its quad core was speedier than the Pi0's and the 'dd'
command task runs in the background undisturbed at 20% CPU and 0.1% memory. It's
merrily zooming along dumping the old drive into the new as we speak.
Clone a Hard Drive Using an Ubuntu Live CD
11.2 dd: Convert and copy a file
How To Clone An Internal Linux Partition To An External USB Disk Using DD
The Best Disk Cloning App for Linux
g4u - Harddisk Image Cloning for PCs
What I learned: dd can be both a powerful and potentially dangerous command when
Mistakes I made: The good news was that I made this minor mistake which was
quite unrelated to the disk duplication via SSH on a Puppy laptop console
window. The same window in which I launched the DD command I wanted to see what
so far had been written to the unmounted, unformatted three terabyte external
USB spinning hunk of iron. I should have launched another command console window
that I could kill without affecting the dd transfer. I typed 'cat /dev/sda' and
my window filled with ascii interpretations of machine code. That answered my
question - yes, something has now been transfered onto the unmounted,
unformatted USB external drive, but it also answered quite loudly, as each '08'
byte rang the terminal bell and there were plenty of them. I succeeded in
annoying myself. Humorous enough but I couldn't stop the display with control c,
z or x and I couuln't figure out how to interrupt it, so I killed the command
console process window on the puppy, which also halted the dd transfer. Ah well,
live and learn.
-- All ladders in the Temple of the Forbidden Eye have thirteen steps. There are thirteen steps to the gallows, firing squad or any execution.