Allen said:
I have read that. I must actually get down to using Linux once and
for.
The "dd" option is good in certain circumstances. It doesn't resize
anything, so the destination must be the same size or larger than
the source. A port of "dd" is available for Windows, if you want
to try it out.
http://www.chrysocome.net/dd
I use dd-0.5 version quite a bit. The only bug I know of, is the
program doesn't always seem to know where the end of a USB storage
device is properly, and perhaps that's fixed in a later version.
I've never had it trash anything, but you have to be *very careful*
while using this. One typing mistake and... kaboom. You can easily
overwrite the wrong disk if you type too fast.
For an SSD, I recommend using a block size argument. That's to reduce
potential write amplification effects. If you do this flavor
dd if=/dev/sda1 of=/dev/sdb1
that would write in 512 byte chunks.
If you do something like this
dd if=/dev/sda1 of=/dev/sdb1 bs=131072
that writes in 128KB chunks, which are the same size as the flash
blocks.
For the Windows version, you have the added convenience of the list
option.
dd --list
That will list the proper Windows syntax for disk naming.
To store that list in a text file right now, I did this. The list
is printed out on stderr, and 2> redirects stderr to the named file.
(I put the .exe on the end, to make it clear this is Windows
)
dd.exe --list 2> output.txt
This is a snipped section from output.txt, which covers the syntax for
one of my two hard drives.
\\?\Device\Harddisk0\Partition0 <--- used to ref. the whole disk
link to \\?\Device\Harddisk0\DR0
Fixed hard disk media. Block size = 512
size is 500107862016 bytes
\\?\Device\Harddisk0\Partition1 <--- first entry in partition table
link to \\?\Device\HarddiskVolume1
Fixed hard disk media. Block size = 512
size is 20974431744 bytes
\\?\Device\Harddisk0\Partition2
link to \\?\Device\HarddiskVolume2
Fixed hard disk media. Block size = 512
size is 20974464000 bytes
\\?\Device\Harddisk0\Partition3
link to \\?\Device\HarddiskVolume3
Fixed hard disk media. Block size = 512
size is 19197771264 bytes
\\?\Device\Harddisk0\Partition4 <--- fourth entry in partition table
link to \\?\Device\HarddiskVolume4
Fixed hard disk media. Block size = 512
size is 438958517760 bytes
To copy one entire disk to the other, you'd do it like this.
dd if=\\?\Device\Harddisk0\Partition0 of=\\?\Device\Harddisk1\Partition0
If the sizes of the disks aren't equal, you have blocksize and count
parameters to use. Switching to Parko's Linux syntax for a moment,
to copy from one hard drive to another, it would look like this.
This transfers 500107862016 bytes. The block size is a multiple of
512 bytes. The first number is 432 sectors, not an even multiple
of a flash block (but then in this case, I'd transferring one
hard drive to another).
dd if=/dev/sda of=/dev/sdb bs=221184 count=2261049
To work out the block size and count parameters, there is a
port of the Linux "factor" program available. I issue the
command like this, in command promot.
factor.exe 500107862016
And the answer comes back like this. I then can pick the
blocksize and count parameters, such that precisely
the entire disk (or a single partition) get transferred,
with no possibility of an overrun.
500107862016: 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 7 67 1607
One factor I see right away there, is 8192 from all those 2's.
So if I was transferring using hard drives with 4K sectors, or
with SSD drives, I might craft a transfer like this.
dd if=/dev/sda of=/dev/sdb bs=8192 count=61048323
The command can also be run without a count, like this,
and this transfers until the source disk runs out of
bytes to give.
dd if=/dev/sda of=/dev/sdb bs=8192
Now, if I did it that way, the Windows port of "dd" reports
the count of items transferred. If all went well, it would
report "61048323" as the number of items (blocks) transferred.
Then I'd have a fair idea it did what I expected.
Using both a blocksize and count, is important for preventing
something you're doing, from overwriting something important.
And the best blocksize, affects the performance of the command.
This command, runs at 13MB/sec on my system.
dd if=/dev/sda of=/dev/sdb
and this command, runs at 39MB/sec on my system. My current
generation drives, "like" multiples of 4096 and the block
size doesn't have to be big. Some previous generation
hard drives, would "like" the 221184 sized number, and
my older (160GB) drives, excel with something 221184 sized.
But the modern drives seem to like the multiple of 4096 a lot.
dd if=/dev/sda of=/dev/sdb bs=8192
And if you're transferring huge chunks of data, it pays off
to use an efficient transfer means. In the case of the SSD,
you'd hope at least some transferring cases there, involve
nice power_of_two numbers, for best flash usage. I don't know
if the SSD behaves that well, when receiving bs=512 (default size)
transfers. It's better to "factor" and work out some good
numbers to use. An SSD prepared on Windows 7 or Vista,
should involve lots of power_of_two type numbers, to align
better to the flash blocks.
The dd command also has "seek" and "skip" parameters, which
allow "moving" a partition, so it doesn't end up with the
same offset. I've used those kinds of options, when "snipping"
a chunk of data off the 500GB disk, for examination with a
hex editor. If you don't own a disk editor, you can snip
manageable chunks out of the disk, and use a hex editor instead.
dd is a very handy command (but bring your hand calculator
)
To get the "factor.exe" program, see the coreutils package here.
http://gnuwin32.sourceforge.net/packages.html
Paul