1

In short, if I do dd disk-to-disk (e.g. /dev/sda to /dev/sdb), is the capacity of the whole disk also copied?

For example, if sda is actually 1TB and sdb 2TB, after the dd, which would a Linux system regard sdb as, 1TB or 2TB?

I assume that the disk capacity is recorded in a separate ROM or small non-volatile storage, not in any sector of the disk. Or, maybe a couple of sectors of a physical disk might be always reserved.

I'd like to migrate systems on an old 1TB hard disk to a new 2TB one with minimal pain. The old disk won't be used. I thought dd might do. The only part that I wasn't sure is if I do dd & the size of the disk capacity is ever copied just like the partition table, the new 2TB disk would become 1TB. I wanted to make sure before actually doing dd.

My Google search was not fruitful, so finally I decided to post a question here.

If all the systems were Linux, I'd consider rsync partition-to-partition & grub-install. However, unfortunately, I have one Windows and do not have a Windows installation usb. I am not sure how to re-install and/or reconfigure Windows boot loader after rsync.

2

HDD size in actual "physical" terms of platter/heads is stored in a internal ROM but it is not user-accessible. Modern HDDs (and SSDs) expose an abstraction called LBA (logical block addressing), which basically tell the OS how many user-addressable sectors the disk has.

dd simply reads until EOF (end-of-file), which can either be the end of disk or partition. Copying your entire 1 TB disk to the 2 TB one with dd will end with a maximum of 1 TB partitioned space on you destination disk - ie: the original MBR/GPT does not know anything about the additional space at the end.

Think about a small box put inside a larger one: object inside the smaller box does not "know" anything about the available outer space. At the same time, to use the additional space provided by your 2 TB disk you need to modify the original MBR/GPT creating additional partitions or expanding the last one.

When copying at user level via tools as cp or rsync, you do not need this simply because your 2 TB disk will (hopefully) be already partitioned to use all the available space, with the filesystem sized according.

1
  • Thank you! I guess I caused some miscommunication. I was wondering if I do dd, I worried that I would not be able to "expand the last partition" or create a new one in the unallocated space." I thought there must be some meta-information that tells, say, parted or gparted the maximum usable capacity of the give disk. If that maximum capacity information were in the partition table, I thought the 1TB would be never used. However, it seems like the size is in a ROM, and there's a protocol for an OS to access it. – Stephen Jan 19 at 18:50

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.