I’m looking to upgrade drives on two of my machines. My server running ubuntu has a 3.5" and will be getting a larger capacity HDD, while my personal computer running endeavor OS will be going from a 2.5" ssd to an nvme drive. (Not sure if it helps giving the drive types, but can’t hurt).

I’m fine with a clean install and reinstalling everything, but to save some time I’d of course like to minimize the effort that goes into it (importing settings etc). Any tips/tricks for either? Thanks in advance

  • TheOubliette@lemmy.ml
    link
    fedilink
    arrow-up
    3
    ·
    18 hours ago

    Set up a proper backup system for your server. I like to use borg. Just to be safe, make a copy of your drive as well (like full disk rsync). Then do a clean install and restore as if your drive had failed. If your backups missed anything, you will now know and can fix your backup system and can still recover from your rsync’d drive.

    You might also want to take this opportunity to start administering your server with code, like using ansible or other remote provisioning tools. This makes your system configuration reproducible so that you only really need to back up a few kinds of data like media files or databases.

  • Steamymoomilk@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    21 hours ago

    I dont know if this would be applicable for your use case.

    But in gentoo one of the recommended ways to backup your system is rsync. Rsync is single threaded, but keeps all softlinks and hardlinks aswell as accepting an eclude list for directorys you want rsync to ignore. I have recovered from some pretty big dumb dumb moments and have used rsync to build packages on my threadripper and syncing them to lower power devices like my laptop and raspi. And they work pretty well!

    If you do decide to go with rsync you can use “rsync -aP (from directory) (to directory)” the “a” stands for archive this keeps all permissons, softlinks and hardlinks. The P stands for a progress bar, so you can see how its going. Another benefit of rsync is you can start copying and stop and start and it will only SYNC over what isnt new or modified. After the files are synced over you need to edit your fstab (its af file where you computer mounts your disks) and grub-mk-config. If not re-install grub

    Hope this helps

    • Nednarb44@lemmy.worldOP
      link
      fedilink
      arrow-up
      1
      ·
      15 hours ago

      That does help. One of the things on my to do list was setting up a backup system anyway, so maybe I’ll play with that. Thanks!

  • schizo@forum.uncomfortable.business
    link
    fedilink
    English
    arrow-up
    6
    ·
    edit-2
    1 day ago

    dd then resize the fs?

    Edit: one caveat here I forgot: if your fstab is using UUIDs, you’re going to have to update that, since the new drive won’t be the same UUID because, well, it’s not the same drive.

    • Drathro@dormi.zone
      link
      fedilink
      English
      arrow-up
      3
      ·
      1 day ago

      Absolutely this. Relatively quick and clean, no messing with installation or reconfiguration. That is, assuming your data isn’t completely corrupted and the old drive doesn’t just outright fail during transfer… But if that happens you were screwed to begin with.

      • Nednarb44@lemmy.worldOP
        link
        fedilink
        arrow-up
        2
        ·
        1 day ago

        The old drives are fine, just either too small or too slow, so it sounds like it may be an option

      • schizo@forum.uncomfortable.business
        link
        fedilink
        English
        arrow-up
        4
        ·
        1 day ago

        two commands: dd and resize2fs, assuming you’re using ext4 and not something more exotic.

        one makes a block-level copy of one device to another like so: dd if=/dev/source-drive of=/dev/destination-drive

        the other is used to resize the filesystem from whatever size it was, to whatever size you tell it (or the whole disk; I’d have to go read a manpage since it’s been a bit)

        the dd is completely safe, but the resize2fs command can break things, but you’d still have the data on the original drive, so you could always start over if it does - i’d unplug the source drive before you start doing any expansion stuff.

        • SavvyWolf@pawb.social
          link
          fedilink
          English
          arrow-up
          5
          ·
          1 day ago

          dd is completely safe.

          Only if you have the correct args and device names. Make a backup if you want to do it from the command line and aren’t feeling 100% confident.

        • Nednarb44@lemmy.worldOP
          link
          fedilink
          arrow-up
          1
          ·
          1 day ago

          Thanks, that’s really helpful. It can be hard to tell between commands and acronyms in conversation with familiarity

          • cmnybo@discuss.tchncs.de
            link
            fedilink
            English
            arrow-up
            2
            ·
            24 hours ago

            Be absolutely sure that you get the source and destination drives correct. If you get them backwards, it will nuke your data. There is no confirmations, dd will start as soon as you press enter.

  • SavvyWolf@pawb.social
    link
    fedilink
    English
    arrow-up
    5
    ·
    1 day ago

    When I’ve needed to transfer data over to a new disk, I’ve used gparted from a live usb to copy/paste partitions directly. Once that’s done, you’ll probably need to update /etc/fstab to point to the new drives and run update-grub (assuming you are using grub) to update the bootloader config.

  • deadbeef79000@lemmy.nz
    link
    fedilink
    arrow-up
    2
    ·
    23 hours ago

    If you’re using LVM, ZFS, or Btrfs then you can use their features and tooling to migrate data from one disk to the other, assuming you’re able to connect both at the same time.

    I’ve done this online with btrfs several times now and it’s quite painless, admittedly only for self hosted stuff.