29
submitted 20 hours ago by mech@feddit.org to c/linuxquestions@lemmy.zip

I've spent considerable time configuring my Linux system (1) and I would like to have the exact same system on another PC (2).
What would be the best way to do that?
Hardware on (2) is different, but tested compatible with the kernel.
(2) has a smaller drive size, so simply dd'ing the entire drive from a live USB won't work.

Here's what I'm planning:

  • install same distro on (2), using the same username as on (1)
  • create a list of installed packages on (1)
  • install same packages on (2) using the package manager
  • copy /home and /etc from (1) to an external EXT4 drive
  • boot (2) from a live USB and mount the external drive
  • delete /home and /etc on (2), then copy them over from (1)

Will this cause permission issues? Is there a quicker way?

top 11 comments
sorted by: hot top controversial new old
[-] a14o@feddit.org 2 points 6 hours ago

What you're planning seems plausible.

You could also resize the partition on (1) to fit on (2), then dd if=(1) of=(2)

If you're interested in structural changes that make this sort of thing easier in the future, look into

  • ZFS or Btrfs for flexible handling of subvolumes
  • NixOS or GUIX for applying system configuration across machines
[-] ProfessorNeurus@infosec.pub 27 points 19 hours ago* (last edited 19 hours ago)

You could use clonezilla right? If the data of the old drive "fits" in the new smaller drive, then it can be done (if I correctly recall, it's one of the advanced options).

https://clonezilla.org/clonezilla-live/doc/02_Restore_disk_image/advanced/09-advanced-param.php

[-] passenger@sopuli.xyz 2 points 7 hours ago* (last edited 7 hours ago)

Or rescuezilla which might be easier to use.

[-] shrugs@lemmy.world 8 points 16 hours ago

In short, you can just copy your whole system, you can use rsync, cp or dd. Two things need to be taken care of:

  • uefi boot needs to be working (copy uefi partition from old drive or reinstall with grub from live iso)

  • partitions in /etc/fstab need to be configured correctly

Everything else ist just the files and configs. Prefer using rsync -A over cp. In Linux everything is a file, except /dev and /procfs

Don't forget to fix hostname and network config if not using network manager.

Your idea should work no problem btw. though, since uefi and fstab is taken care of by the previous clean install. You should probably not overwrite fstab in that case IMHO.

[-] isgleas@lemmy.ml 7 points 17 hours ago

ReaR (RElax And Recover) can help you create a bootable "recover" installation on target system, once installed rsync your data

[-] aarch0x40@piefed.social 9 points 19 hours ago* (last edited 19 hours ago)

You could just use dd to copy the old drive over the new one then resize the partitions.  Or you could partition the new drive and dd copy the slices you want to cut over then resize the filesystems.

[-] mech@feddit.org 1 points 19 hours ago

Can I dd from a bigger drive to a smaller one and expect all the data to come with it?
(Assuming of course there's not more data on the bigger drive than will fit on the smaller)

[-] y0din@lemmy.world 9 points 19 hours ago* (last edited 19 hours ago)

No, dd won’t work reliably when copying from a larger drive to a smaller one. To do this, you would need to resize and align the partitions first, handling each partition individually, or use a different cloning method.

A better approach is to use something like Clonezilla. In advanced mode, it allows you to clone from a bigger disk to a smaller one, provided that the used space on the source drive does not exceed the capacity of the target drive. Without this, it won’t be possible with any tool, not just dd.

Here’s a tutorial for Clonezilla advanced mode:

https://clonezilla.org/clonezilla-live/doc/11_lite_server/advanced/09-advanced-param.php

(edit added link, and saw the second post just before me with the same answer, not trying to steal from it @ProfessorNeurus@programming.dev, sorry!, you posted while I wrote mine, so please feel free to ignore this, feels so dumb to just delete posts)

[-] aarch0x40@piefed.social 3 points 19 hours ago* (last edited 19 hours ago)

You would want the source partitions to be equal to or smaller than the target.  You would need to resize them first

[-] nesc@lemmy.cafe 0 points 19 hours ago
[-] Tuuktuuk@piefed.ee 1 points 8 hours ago

dd between two different hard drives?

this post was submitted on 20 Dec 2025
29 points (100.0% liked)

Linux Questions

3018 readers
86 users here now

Linux questions Rules (in addition of the Lemmy.zip rules)

Tips for giving and receiving help

Any rule violations will result in disciplinary actions

founded 2 years ago
MODERATORS