14:30 - Thursday, 24 April 2014

Windows Partition Table Reports A Partition Is Larger Than The Physical Disk

The computer in question is a Windows 8 machine. I’ve cloned a SSD using dd, like so: dd if=/dev/sdb of=/dev/sda.

The machine boots with the new hard drive, and the issue is that the partition table from the source was 1TB, the destination drive was only 480GB. Windows still thinks that the drive is 1TB, and I need to resize the partition so it’s aligned with the physical disk.

Doing a low-level disk clone with dd from a larger disk to a smaller one is very likely to result in lost data. Any files that happened to be stored after the 480GB mark on your source disk will now be lost on your 1TB target. Thus, the best way to do the job is to use another utility. Offhand, I don’t know of any Linux utilities that will do this job for NTFS (IIRC, ntfsclone requires that the target be at least as large as the source). I’m sure there are Windows backup utilities that will do the job. I’ve used XML Backup once or twice in the past, but it’s been a while, so I’m not sure how well it would handle your situation. Alternatively, you could use ntfsresize to shrink the source filesystem before cloning the disk with dd or ntfsclone. Be aware, though, that filesystem resizing tools always pose a risk; you could end up losing data in your effort to clone the filesystem.

I don’t know offhand how ntfsresize or similar utilities will react to a filesystem that’s larger than the containing disk. They might work, or they might crash or even damage the filesystem. Thus, to be safe, I recommend going back and doing it again in a more appropriate way.

Make a partition as big as the drive and use ntfsresize.