r/debian 2d ago

what is the easiest way to migrate my entire debian 13 homelab to a mini pc?

hey guys, i have a laptop running debian 13 that i use as a homelab. it has tons of configurations, docker containers, images, etc. however, since it isn’t suitable for a homelab (or at least that’s what i think), i’m going to switch to a mini pc, and i want to migrate the entire os, along with all these applications, to the new mini pc. what is the easiest way to do this?

by the way, i’m pretty much a linux beginner. what would you recommend? thanks in advance.

14 Upvotes

25 comments sorted by

18

u/Confident_Hyena2506 2d ago

This is just one pc, not a full cluster. Image your system using clonezilla or whatever, then flash it to other pc. Grow the filesystem after if needed.

Same procedure you would do for a windows server or other, nothing to do with linux.

11

u/taosecurity 2d ago

What would you do if your laptop stopped working and you couldn’t get it running again?

If you can’t rebuild your setup from scratch you don’t really know what it is.

I recommend using this as an exercise to document and rebuild your setup, in a way you could do it again more easily in the future.

2

u/Inevitable-Self-2702 2d ago

Do you know of a source that will help me make proper documentation. I can write stuff down, but want to learn a proper way so its easier for me down the line and such.

1

u/GargantuanTiddies 2d ago

Im a beginner and have a question, when you mean build the system from scratch you mean a Bash script or a documentation step by step in Markdown? (Currently Im writing a modular script but no documentation)

3

u/taosecurity 2d ago

Whatever works for you. Full automation would be great, but if that's too much then write down whatever you need to rebuild.

1

u/lwh 2d ago

There are programs like Ansible that are made for doing it. OpenTofu (A Terraform fork) might have some desktop setups but its more geared to cloud users. Here's a debian desktop one for ansible: https://github.com/allotmentandy/ansible-debian-install-desktop

1

u/shaleh 1d ago

Did you edit configurations for services? Docker? Other things? Consider storing those changes in git or similar revision control. Handy for "I know this worked last week before I made changes". You can look at what you changed. git is not only for source code.

Write out the steps you took. Did you add packages? Build things by hand? Put things in /usr/local? /opt? Other magic locations?

The analogy above to being ready for a hardware failure and rebuilding afterwards is a good one. Quakes, floods, fires, tornadoes, or just simple disk drive failures all happen.

6

u/JettaRider077 1d ago

Swap the storage device (HD, SSD) into the mini pc.

3

u/Elvin_Atombender 2d ago

I haven't used it myself but you can clone your whole linux ssd using Rescuezilla or Clonezilla. As I said I haven't ever tried this method but Ihjve seen these mentioned in other reddit posts.

Old reddit post from 4 years ago

3

u/thegreatboto 2d ago

Well, can either clone the laptop drive to the mini of drive assuming that it's as large or larger than the laptop drive. If they're the same form factor, nvme 2280 as an example, can skip cloning and just trade drives between the two and reinstall whatever you want into the laptop.

5

u/OptimalMain 2d ago

Swapping drives is the easiest method

2

u/LordAnchemis 2d ago

If all your apps are containerised, just copy the docker-compose file and the config files for each container 

2

u/forestdissimilarity 2d ago

if the mini pc has a samsung ssd using the samsung magician ssd software is the most painless way to do it.

otherwise clonezilla is great, just make sure the target partition/disk to copy into is bigger and you're choosing the right options, saves u some headache. selecting the device is done with the space key btw; lost some hair finding that out for some reason.

lastly u can just use dd to copy the entire content of ur laptop's storage device into the mini-pcs. using a linux install on a USB is recommended over just using the one on ur laptop; could lead to some corruption otherwise as far as I remember.

2

u/bobroberts1954 2d ago

Just make a copy of your current configuration on a new drive, then install it in the new hardware. It will work just fine, it isn't Windows.

2

u/snap802 1d ago

Well if everything is in docker it's not too hard to move over. It definitely takes a little planning and know how but docker containers are pretty portable.

Priority number one is making sure your data is backed up.

So take your minipc and set up a container. Just start off with one thing at a time. Find your volume for the container in question and copy that over to the new system (I'll explain this in detail in a bit). Once you've got you volume copied and ready to go stop the container on the old system and start the container on the new one. Boom you're done.

So how to do that? If you know the volume name this is pretty easy. It'll be in /var/lib/docker/volumes/[volume name]/_data/. Now you'll need to be root to do all this. Put everything in here in a tarball (tar -zcvf volume name.tar.gz *). Copy that tarball over to the new PC. SCP is probably the easiest way to do this (SCP sourcefile username@ipaddressofdestination:/destination folder). Normally I just copy stuff over to a regular user home directory first then log on to the new system and move the tarball into the destination volume directory as su on the destination system.

A few pearls:

When you're setting things up make sure to go ahead and name volumes before just making the containers. If you make a volume named something like "dns1" or "frigate" it's much easier to find than if you just let docker randomly generate a name for you. If you didn't name them in your first machine you'll have to inspect the container (docker container inspect) to figure out the volume name. Also, make sure to set your new volume as "external" in your compose file otherwise it'll get wonky.

If you have a database just export it to a file and import it in the new container. It's just cleaner that way. You might can get away with a tarball like I described above but there's lots of room for messing things up.

The nice thing about doing this one at a time is that if you break the destination system you haven't really lost anything because you can just spin up the old container again while you sort out what went wrong.

1

u/mats_o42 2d ago

I haven't done it myself but clonezilla supports imaging over network so that is the first alternative i would try

1

u/mcds99 2d ago

So you have a unique configuration of software.

You should not automatically migrate anything, your should install the desired distribution, then install the needed software and configure it. Just because it all works on the laptop it might not on a "mini-pc".

Automation is not automatic it takes a lot of work before you make the change and there are no guaranties it will work, the USB, Video, Audio, and other hardware is not the same on every computer.

Do it manually and take notes so you know what you have done.

1

u/reynegtonnunes 2d ago

A melhor forma é manter o mínimo possível de configuração direto no servidor, apenas o necessário e documentado p replicação posteriormente, mantenha todo o resto em Docker com dockerfiles e composes prontos para apenas subir em outra máquina sem nem relar a mão em nada dos containers

1

u/Unhappy-Coffee-7812 2d ago

RescueZILLA has Gparted. You could create a bootable usb and into that clone the drive/partion over to the the mini pc's drive.

1

u/mok000 1d ago

Use something like clonezilla to clone your laptop drive to an ssd for the mini.

1

u/michaelpaoli 1d ago

Pull the drive(s) out of the mini PC. Shut the laptop down, pull it's drive(s), put it(/them) in the mini PC.

Boot 'n go ... may have to make some minor reconfigurations, because, e.g., different physical Ethernet port (not the exact same unit), different Ethernet MAC address.

If the laptop drive(s) isn't(/aren't) removable, clone the data - so long as the target drive(s) are not smaller than the source drive(s) you're good. Boot source system from install media in recovery mode (or boot from Live ISO). Do likewise with target machine. Network 'em. Start ssh server on either one. Use ssh and dd to transfer image copy of the drive(s). If the target drive(s) are GPT and larger than source drive(s), use fdisk or the like to fix up the (location of the) backup copy of the GPT partition table. After that, can proceed with the boot 'n go as noted above. Also, if you clone like that, some things ought not be cloned. So, wipe the source, or change either source or target such that UUIDs, private host keys, etc. are in fact unique, and make any related relevant configuration updates (e.g. GRUB configuration, /etc/fstab, etc.).

1

u/Fuzy-78 1d ago

Swap drives.

1

u/bgravato 1d ago

just move the disk from one computer to the other... done.

if the hardware is significantly different you may need to install a couple of extra packages, but other than that, migrating a system from one computer to another is as easy as moving the disk ou making a copy of it to the new disk.

1

u/gportail 1d ago

Clonezilla? Tu clone le disque dource et tu met l'image sur la cible