The title pretty much speaks for itself... I have a linux install that I've spent a considerable time configuring, which is unfortunately installed on a drive that's starting to show signs of dying.
My question is: how, if there is a way, can I migrate said linux install over to a different drive, while preserving all the configurations and such.
EDIT: Thank you to everyone who commented! I made the transfer, using dd and it went mostly smoothly, even if it did take a while.
Get a same sized drive (or larger) and just dd it? I used to do that all the time, even to Windows installs, if I knew a drive was starting to become unreliable. I'd advise mounting the original/donor drive as read-only to mitigate any potential data losses while transferring. But dd makes a perfect bit for bit copy of any partitions, drives, etc that you feed it. Just don't get the inputs/outputs backwards! And always remember: dd stands for "disk destroyer" because if you get it wrong, bye-bye data.
You should do backups for cases like that. And mind that harddisks might fail and laptops and phones can get stolen, you might want to backup your data regardless if it's important to you.
The trick with 'dd' is to pay attention to the destination. "of=" is the one thing to worry about. If you make a mistake there, it'll overwrite somehing. Everything else isn't as critical. And you can use some graphical interfaces like Clonezilla. It's the same thing there: pay attention to what you're overwriting... But the GUI might make it easier to use an understand what you're doing.
Sure. Just wanted to make sure you have something backed up, just in case something goes wrong. You shouldn't need that anyways. But that's why all the people here recommend 'dd'ing the harddrive. This way you don't need to re-configure or install anything. It'll copy everything and just boot up as before.
Additional advice: Detach unnecessary drives before starting the process. That way you can't overwrite other things and it'll be just one disk to worry about. Buy a new drive that's the same size or larger. Expand the partitions at some point afterwards if it's larger, to access the new space. And after 'dd'ing a whole drive: Don't run the computer with both drives connected at the same time. The partitions will have the same identifiers, as it's an exact copy, and that might lead to confusing situations or the computer reading/writing to the wrong disk. Just detach the old drive after you're done and before booting again. You don't need that old hdd anymore. And use a Live CD / USB-Stick / Clonezilla to do it. Don't 'dd' the system while it's running itself.
I've done it several times. Worked very well each time. And it's not that much of an effort. Get an USB-Stick ready and install the new harddisk, 15minutes of work to get the copying started and then you just have to wait for it to finish, shut down, detach the USB-Stick and the old harddisk and you're pretty much done. It'll come up just as it was, just with a new harddisk inside.
There's an old article on the Arch wiki I used to use HERE. For simplicity I'd just always use section 2.2. Hasn't ever steered me wrong, but I'm also under no illusions that no digital data is sacred. And if it IS sacred, then it's already backed up under the 3-2-1 approach. Just make sure you know which device is which so you don't mix up "if" and "of". There's probably significantly more user friendly ways of doing it, but I guess I'm old now so I'm stuck in my ways.