I used to have two identical 500 GB SSD drives: one inside a laptop, one outside. I would make regular backups using dd
from the internal HDD to the external one, as their capacity matched.
I now have a new laptop, which has an NVME drive with (drum roll) 512GB. I am slightly worried about this cosmetic capacity increase crippling my ability to use my perfectly good 500GB SSDs for backups.
I have checked, and dd
doesn't seem to care much if it runs out of space in the target file at some point in the copy process - it just stops.
To ensure that I don't end up losing data from the OS drive, I have re-partitioned it to only use 500GB (to match the size of my external drives), leaving 12 GB of unpartitioned space on the NVME.
Question: Will there be any low-level UEFI confusion happening when trying to boot a Windows 10 system image restored to a 512GB NVME from the smaller 500GB SSD drive using dd
, if I partition the aforementioned system image to only use 500GB of space on the NVME?
EDIT: Following the advice I have been given, I have reduced my partitions on the source disk (512 GB NVME) to be around 499 GB in total, allowing some space for the partition table. Then I have performed a dd
backup to an SSD:
dd if=/dev/nvme of=/dev/sda ibs=8192 obs=8912 status=progress
Once completed, gdisk has complained about finding 5 problems.
I have issued a gdisk
e
command (load main partition table from disk (rebuilding backup)) and then w
(write table to disk and exit)
After this the disk would pass verification (v
) but I could no longer boot Windows from it. How can I troubleshoot this further and figure out what has gone wrong? I will try to compare gdisk
p
output for the source NVME drive and the resulting clone SSD to get some clues.
EDIT 2:
Here is comparison of the two partition tables (they match):
Disk /dev/nvme0n1: 477 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: PC401 NVMe SK hynix 512GB
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 4610F6E8-FE3A-4E46-AD07-2CA1F0EE3F0A
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 1023999 1021952 499M Windows recovery environment
/dev/nvme0n1p2 1024000 1228799 204800 100M EFI System
/dev/nvme0n1p3 1228800 1261567 32768 16M Microsoft reserved
/dev/nvme0n1p4 1261568 356517887 355256320 169.4G Microsoft basic data
/dev/nvme0n1p5 356517888 972947455 616429568 294G Microsoft basic data
/dev/nvme0n1p6 972949504 975046655 2097152 1G Microsoft basic data
Disk /dev/sdb: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Disk model: SSD 750 EVO 500G
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 33553920 bytes
Disklabel type: gpt
Disk identifier: 4610F6E8-FE3A-4E46-AD07-2CA1F0EE3F0A
Device Start End Sectors Size Type
/dev/sdb1 2048 1023999 1021952 499M Windows recovery environment
/dev/sdb2 1024000 1228799 204800 100M EFI System
/dev/sdb3 1228800 1261567 32768 16M Microsoft reserved
/dev/sdb4 1261568 356517887 355256320 169.4G Microsoft basic data
/dev/sdb5 356517888 972947455 616429568 294G Microsoft basic data
/dev/sdb6 972949504 975046655 2097152 1G Microsoft basic data
However, I am unable to boot from the external drive. When launching gdisk on the healthy bootable source disk I get:
The protective MBR's 0xEE partition is oversized! Auto-repairing.
I don't get this message when running gdisk on the clone. Could it be that in reading the partition table incorrectly gdisk is somehow corrupting it?
Could it be the use of Bitlocker that is making the GPT table 'odd'? I had no issues with Truecrypt previously..
EDIT 3:
I am typing this from an OS running on a successfully cloned drive! The recommendation from the accepted answer has worked. To summarise:
- Reduce the used space on the 512 GB source media, by shrinking the last partition by a bit more than 12 GB (to allow for the partition table copy to reside at the end of the disk)
- Perform a dd clone from 512 GB source media to the smaller 500 GB disk.
- Run fdisk (i.e.
fdisk /dev/sdb
) and select w option to rebuild the backup header (fdisk will offer this action to be performed by default whe changes are written to disk)
After these manipulations I have been able to successfully use the drive.
dd
is not a Windows utility. Maybe you should ask about the problem, rather than about the solution.dd
becomes a Windows utility as soon as somebody ports it to Windows, but the post did not actually say that the backup would be done from within Windows. (Indeed it would be a bit odd to do a disk image from within the same OS that you're imaging, unless the imaging tool can make use of VSC.)