0

I am using the following cmd where sda(500GB) is my laptop hd (unmounted) and sdc(500GB) is my external usb hd

dd if=/dev/sda of=/dev/sdc bs=4096

When complete this returns

122096647+0 records in
122096646+0 records out
50010782016 bytes (500GB) copied, 10975. 5 s, 45.6 MB/s

This shows records in != records out

fdisk -l

returns

Device    Boot  Start   End         Blocks      Id  System
/dev/sda1 *     2048    718847      358407      7   HPFS/NTFS/exFAT
/dev/sda2       718848  977102847   488192000   7   HPFS/NTFS/exFAT

/dev/sdc1 *     2048    718847      358407      7   HPFS/NTFS/exFAT
/dev/sdc2       718848  977102847   976384000   7   HPFS/NTFS/exFAT

This also shows differences between the Block sizes

Another question is it normal for dd to take 3 hours for a 500GB copy.(laptop ssd to normal non ssd usb hd)

My Physical Sector on windows is 4096 whilst Logical Sector is 512

1

The target disk must be a few kB smaller than the source disk. “500 GB” as a disk size means “at least 500,000,000,000 bytes”; you can't count on all 500 GB disks to have exactly the same number of bytes. Since all the partitions have the same size and position, the part at the end that doesn't fit isn't used anyway, so this isn't a problem.

45 MB/s is pretty good for a USB hard disk. But you'll probably get slightly better speed if you use a more appropriate tool: dd forces a fixed buffer size which is rarely optimal, and 4096 is really on the small side. I ran benchmarks (they might not match your system, of course) and found that cat was faster than dd, though dd can approach cat on performance if you get the block size right (typically around a few MB). But since using dd is tricky and can lead to data loss, better use the simple cat.

cat /dev/sda >/dev/sdc

Any “sector size” is irrelevant here, this matters for data access performance but not for doing a whole-disk copy.

  • I am trying to use cat since your post, however this returns cat: write error: No space left on device, shouldn't cat /dev/sda > /dev/sdc work regardless of the config of /dev/sdc (aslong as the target id 500GB ofc) – Jimbo'sGun's Jul 15 '16 at 19:44
  • 1
    @Jimbo'sGun's Since the target disk is smaller, this will happen no matter what tool you use. – Gilles 'SO- stop being evil' Jul 15 '16 at 20:25
  • Generally you maybe right about that, however thats not the actual reason for the error in my case. My HD is showing as 10MiB when its actually 400+GB and this is the reason for the error. What isnt explained very well online is that other factors come into play when using dd and cat, it appears that even though its reported online that dd and cat copy entire states they can clearly only do so when the config of the target is preconfigured - it is false that one can just take a target harddrive(with enough space) and clone from a source with dd/cat... Software on that HD determines the outcome – Jimbo'sGun's Jul 15 '16 at 20:33
  • @Jimbo'sGun's I don't understand what you mean by “config of the target is preconfigured”. You can clone a hard drive with cat (or dd). What is already one the target drive is irrelevant, it'll just get overwritten. – Gilles 'SO- stop being evil' Jul 15 '16 at 21:38
  • I meant that whatever is on the target is relevant - however my belief of this was founded from unexpected behaviour. It appeared that unplugging-plugging the USB HD didn't allow for linux to refresh the HD status, causing my HD to report incorrectly, thus causing strange dd/cat behaviour. My other thread contains the full unix.stackexchange.com/questions/296213/… – Jimbo'sGun's Jul 16 '16 at 0:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.