I’ve just learned about a very old but pretty cool Linux command – sfdisk. Somehow I’ve always managed to use fdisk and parted, but sfdisk is also very useful. Specifically, I’ve learned to use it for copying partition of one (old) disk to new (replacement) disk.
Confirm Disk Partition Layout
New disk (for this example today) didn’t have any partitions:
Save Disk Partition Layout into File
Very simple command to save layout into partitions.txt file:
Apply Partition Layout from File to Disk
And this is how I can apply the layout from file partitions.txt to the new disk /dev/sdb: