this post was submitted on 22 Oct 2024
26 points (96.4% liked)

Linux

8152 readers
123 users here now

Welcome to c/linux!

Welcome to our thriving Linux community! Whether you're a seasoned Linux enthusiast or just starting your journey, we're excited to have you here. Explore, learn, and collaborate with like-minded individuals who share a passion for open-source software and the endless possibilities it offers. Together, let's dive into the world of Linux and embrace the power of freedom, customization, and innovation. Enjoy your stay and feel free to join the vibrant discussions that await you!

Rules:

  1. Stay on topic: Posts and discussions should be related to Linux, open source software, and related technologies.

  2. Be respectful: Treat fellow community members with respect and courtesy.

  3. Quality over quantity: Share informative and thought-provoking content.

  4. No spam or self-promotion: Avoid excessive self-promotion or spamming.

  5. No NSFW adult content

  6. Follow general lemmy guidelines.

founded 1 year ago
MODERATORS
 

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.

you are viewing a single comment's thread
view the rest of the comments
[–] Drathro@dormi.zone 11 points 1 month ago (1 children)

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.

[–] Presi300@lemmy.world 3 points 1 month ago (2 children)

Yeah, but how do I "Just dd it". I know all about disk destroyer, so I'm a bit terrified of dd and have never really used it like that before...

[–] hendrik@palaver.p3x.de 4 points 1 month ago* (last edited 1 month ago) (1 children)

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.

[–] Presi300@lemmy.world 2 points 1 month ago (1 children)

I do have backups, I just don't wanna bother reconfiguring the system and reinstalling everything

[–] hendrik@palaver.p3x.de 2 points 1 month ago* (last edited 1 month ago)

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.

[–] Drathro@dormi.zone 1 points 1 month ago

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.