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.

  • bloodfart@lemmy.ml
    link
    fedilink
    English
    arrow-up
    3
    ·
    29 days ago

    I’m glad you got it sorted with dd.

    One thing people don’t often realize about dd is that it copies all the data from one drive to the other, including uuids that were written when the old drives filesystem were created.

    For that reason it excels at cloning one’s boot disk, because when the old drive gets removed from the pc, the clone drives os says at some point during the boot process “okay, let’s mount the filesystem with uuid ABC123 at /“ and it works.

    Dd is also not the best tool for cloning disk that you intend to leave hooked up because if you do it’ll put the poor host os in a “I’m seein’ double here, four spidermen!” Type situation.

    • Presi300@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      29 days ago

      I was also one of those people who didn’t realize that it copied UUIDs. I only figured that out, because I imagined that I’d have to update the fstab to point to the UUIDs of the partitions on the new drive.

  • shrugs@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    30 days ago

    Linux is pretty forgiving. You don’t even need to use dd, if you know what you are doing you can create a totally new partitioning format and just copy the files. Since getting the fstab just right in that case is more error prone, just using dd is simpler. If using dd, don’t worry, you can resize partition afterwards.

  • JTskulk@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    arrow-down
    1
    ·
    30 days ago

    If it were me, I’d do a fresh minimal install of the same OS, boot to the livecd and then delete pretty much everything except for /etc and /boot. I’d then cp -ar all my files from the failing drive and then manually merge /etc back. I say manually merge because most things would get replaced by my old files, but I’d manually modfify my fstab to keep the new partition information and add my extra mounts after it. Maybe that’s just me though. You can also just dd and then resize partitions if necessary.

  • Steamymoomilk@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    1
    arrow-down
    1
    ·
    30 days ago

    You can partition your drive identically and rsync your directorys over. Rsync will keep all softlinks and hardlinks. You made need to reinstall grub tho.