26
submitted 2 months ago* (last edited 2 months ago) by Presi300@lemmy.world to c/linux@lemmy.world

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
[-] hendu@lemmy.dbzer0.com 4 points 2 months ago* (last edited 2 months ago)

Assuming the new drive is an equal size or larger: Boot from a USB drive and use dd to clone the old drive to the new one. Then, remove the old drive and boot from the new one. You'll also need to resize the partitions on the new drive if it's larger.

[-] Presi300@lemmy.world 1 points 2 months ago

Yeah, but... how. I'm a bit terrified of dd and have only really used it to make images of drives before...

[-] LunchMoneyThief@links.hackliberty.org 4 points 2 months ago* (last edited 2 months ago)

I usually use

dd status=progress conv=sync,noerror bs=64k if=/path/to/source/drive of=/path/to/destination/drive

Take a reading of the drive health first with something like smartctl and if it has a lot of failing attributes, consider lowering the block size to something rather smaller like bs=512.

Edit: To elaborate, using the sync and noerror arguments will instruct dd to ignore errors and continue in the event of read failures, while allocating zeroes to the remainder of the block space. Which is also why smaller block sizes are better for potentially failing drives. The copy will take longer, but a single error won't take large swaths of data with it.

[-] Presi300@lemmy.world 1 points 2 months ago

Hm, using a smaller block size does make sense, but I imagine that cloning an entire drive with 512 byte blocks is gonna take 10 million years. Especially this one, since the main reason I'm suspecting that it has started failing is because it's slowed down to the point where it drags down the entire system when even the smallest of loads hit it...

[-] possiblylinux127@lemmy.zip 2 points 2 months ago

That's a bad sign. First off stop using it so that you don't make it worse. Next take a backup. I think dd automatically skips over bad blocks but I don't remember. Also, I would not go straight to another drive but instead go to a file.

I don't mean to freak you out but there is a chance you are going to lose data.

[-] Presi300@lemmy.world 1 points 2 months ago

I already have all data I care about backed up, so even if I lose some, it's not a big deal

[-] sylver_dragon@lemmy.world 1 points 2 months ago

If you suspect a failing drive, you may want to consider using ddrescue as opposed to dd. The tool is specifically designed to help with failing disks.

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

Linux

8319 readers
151 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 2 years ago
MODERATORS