Back when HDDs were dominant, it's common to use the dd command to migrate system disks. But that creates a problem with SSDs: unused space from the source disk will also be written once, with either zeros or garbage. SSDs don't like that; they need to know which sectors hold really useful data.
Yes, I know I could do a fstrim or Optimize Disk after the migration, but that approach is imperfect: partition gaps, reserved partitions (like MSR), and space allocated but never actually written to (NTFS MFT/btrfs metadata/GlobalReserve/ext4 inode space?) cannot be trimmed. As an enthusiast I'd like to find a way not to mis-allocate one MiB on my new shiny SSD.
Then I came across the conv=sparse option of the dd command. Seems that by doing a dd if=/dev/sda of=/dev/sdb bs=4K conv=sparse, one could skip all unused sectors when moving data from old SSD to new SSD, assuming that both has the Deterministic Read Zeros after TRIM feature. But will that create new problems? For example, some database redo-log files are inherently packed with 0s, then will it create errors if a sector of 0s is allocated in the OS but not in the underlying flash storage?
Any insights are welcome.