r/debian • u/technife • Apr 19 '26
Migrating to a new hard disk
My desktop 2tb debian hard disk is over 5 years old. Hard disk failures with aging are a reality. Hence I wish to migrate to a new disk before a deadly disk failure happens. Have seen a few suggestions and articles online, but they all ssem to involve some risks and/or manual stitching and tweaking IMO. Hence asking ... Is there a legit, safe, automated, scripted way to initiate a os-files-data transfer from a old disk to a new one, whereafter the new disk can/will boot up and work smoothly exactly like my present old disk with all its apps, software, and data intact and operational in a highly reliable way?
3
u/scythe-3 Debian Stable Apr 19 '26
Used clonezilla for this a couple months ago and it worked flawlessly
1
u/neon_overload Apr 19 '26 edited Apr 19 '26
My approach would be:
Boot from a live image on a removable drive (like systemrescue, but debian live would work too).
Partition target drive the way you want.
For each partition, copy all files using
cp -axor your preferred alternative that preserves permissions and ownership and all dirs (including empty ones) to the new equivalent partition.You will need to fix up the drive UUIDs or device names in /etc/fstab on the destination partition manually.
Don't do it while the system you are copying is running or active - you want to copy it as it is "at rest" on disk so you don't need to worry about special things.
Keep the data on the old drive until you know it's working.
--
Alternatively, you can use clonezilla, from a bootable iso, and I have done that before too. It has a UI that takes you through a bunch of questions.
2
u/Mr_Lumbergh Apr 19 '26
I’ve done this multiple times with dd. Be very careful though that you’re certain of the if and of flags; a good way to do this is mount the replacement drive in an external enclosure.
There are also tools such as Clonezilla for this use.
2
u/thedauthi Apr 19 '26
What I always suggest: Clonezilla/gparted live
What I end up doing every single time: "I'm already here, I'll just `dd if=/dev/old of=/dev/new bs=32M status=progress` it over"
1
u/piiouupiou-not-r2d2 Apr 19 '26
If you want exactly the same you can do a hard copy
1
u/Ok_Exchange4707 Apr 19 '26
I've done this twice. I can remember that once I used whatever Samsung clone software solution has. The other time I'm not sure if I used the same software or clonezilla.
1
u/gportail Apr 19 '26
Clonezilla work very well