Swapping out an old 2TB pcie 3 drive for a newer 2TB pcie 4 drive.
I was leaning towards using dd, after shrinking the partition on the source drive so it doesn't also 'copy' all the empty space.
Have you done this recently? What was your method?
Or is there a CachyOS/kde tool I may be unaware of?
For my personal workstation, it's such a rare thing I always use that an excuse to start from scratch again. If it's like a business system or something, usually build a new system and migrate data and services to it gradually.
I so rarely do in-place upgrades of system drives unless it's a recovery or something.
I would add that a slightly better way would be to do it in raid1 mode instead of single mode.
That way you can move the data over by running a balance, instead of by removing the old volume, which would survive the process being interrupted by a reboot or whatever else.
Then after the balance you can remove the old volume and turn the new one back into a single volume.
I usually use Clonezilla and have it verify the data after cloning. It works for local drives, but it can also clone a drive over the network by running it on both the source and destination system, which is very useful for remote servers (eg moving a VPS to a different location).
I always use dd or ddrescue. Takes 20min to open the computer, connect the drives, boot from usb, copy everything and you'd be done. Also super easy. Just pay a lot of attention before hitting enter. One small mistake and you copy it the wrong way around. Or overwrite your old drive in some other way.
Same thing you suggested, plus a btrfs scrub to check integrity when finished. I suspect btrfs provides a more elegant mechanism for this, which I have been too lazy to look up.
I could never reinstall ... I end up customizing so extensively that a few years ago, I centralized all of my customizations in a VM image that I clone if I do need a fresh install.
Device Boot Start End Blocks Id System
/dev/sda1 * 1 27 209920 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 27 525 4000768 5 Extended
Partition 2 does not end on cylinder boundary.
/dev/sda5 27 353 2621440 83 Linux
/dev/sda6 353 405 416768 83 Linux
/dev/sda7 405 490 675840 83 Linux
/dev/sda8 490 525 282624 83 Linux
The two things you should take note of are
the unit size, and
the "End" column.
In this case you have cylinders that are equal to 8225280 Bytes.
In the "End" column sda8 terminates at 525 (which is 525[units] * 16065 * 512 = ~4.3GB)
dd can do a lot of things, such as starting after an offset, or stopping after a specific number of blocks.
We will do the latter using the count option in dd. The command would appear as follows:
Where -bs is the block size (it is easiest to use the unit that fdisk uses, but any unit will do so long as the count option is declared in these units), and count is the number of units we want to copy
Note that we increment the count by 1 to capture the last block).
Note to display units in cylinders: fdisk -l -u=cylinders /dev/sda
Note for newbies of dd that of= can be a device you write to i.e. /dev/sdc, rather than a path to an iso image.
all 33 comments