512B to 4KiB (Advanced Format) HDD cloning with dd

5,317

Solution 1

Which kind of advanced format drive is it? Does it have the "AF" logo (which means the drive presents 512-byte sectors at its interface, i.e. it's really a "512e" drive) or the "4Kn" logo?

If the former, you don't have to do anything special - you can treat it just like a legacy drive, though proper partition alignment is a good idea (it can make a huge difference in performance).

If the latter, you can't copy it "without any modifications", because the file system metadata has to change. For example, a 512e "4 GB" drive will have LBNs from 0 through about 7,812,500,000, while a true 4K native "4 GB drive"'s LBNs will only go up to about 976,562,500. So the LBNs in the metadata of a 512-byte-per-sector drive would make no sense on the 4Kn drive.

Solution 2

Okay, I think it is worth to post what I have done myself as an answer.

I've used the following command to clone the drive:

dd if=/dev/sda of=/dev/sdb ibs=512 obs=4096

Here, the first option ibs instructs dd, that 512 bytes should be read from the source at a time and obs that 4096 bytes should be written at a time to the destination.

The whole procedure went without any issues. After it was completed, I disconnected the former drive and did try to boot from the new one. It booted and all of partitions were properly shown.

To be assured if the aligning is good for this Advanced Format drive, I've downloaded WD Align tool from the Western Digital website and it shows, that all is properly aligned, here is a screenshot:

enter image description here

I don't know if extra options was of any use for this though.

Share:
5,317

Related videos on Youtube

Neurotransmitter
Author by

Neurotransmitter

This space intentionally left blank.

Updated on September 18, 2022

Comments

  • Neurotransmitter
    Neurotransmitter almost 2 years

    What is the best practice to clone with a dd an existing 512-bytes-per-sector HDD (whole disk, not specific partitions) to a modern 4-kibibytes-per-sector Advanced Format drive? What options should be used? Does they matter at all?

    • Ramhound
      Ramhound about 9 years
      Here is an related question you might want to read. You are also making it more complex then it needs to be. All you do is create a 1MB partition at the start for the device, so it is aligned, and leave the rest empty. The firmware of your device likely has emulation. Here is more additional reading
    • Neurotransmitter
      Neurotransmitter about 9 years
      I've read the question (and ansers) you mention, but my question is simpler and dd-specific. I don't ask how to prepare a drive for a proper aligning, what I want to know is to how to completely copy the entire disk structure (and data). Without any modifications to it.
  • Neurotransmitter
    Neurotransmitter about 9 years
    The hard drive in question is WD30EZRX, which have 512 B logical sector and 4 KB physical and it's marketed as Advanced Format drive.
  • Jamie Hanrahan
    Jamie Hanrahan about 9 years
    Thought so. It's a 512e drive. 4Kn drives are (afaik) unheard-of outside of the "enterprise" market (and are priced accordingly). So, except for the partition alignment issue, you can treat it as a 512-byte-per-sector drive.
  • Neurotransmitter
    Neurotransmitter about 9 years
    Thanks for a clarification, marked your answer as a solution.