r/linuxadmin • u/InvincibleKnigght • Feb 19 '26
Migrating old server to new using rsync
Hello everyone!
I'd like to preface this by saying I have been using linux for the past 6 years and I'm fairly confident in my skills to read documentation, and follow tutorials with debugging.
My PhD supervisor has bought me a new linux workstation with better specs and a newer GPU for my work. I have asked my IT head to help me migrate and he said he has rsynced the /home folder.
I have been maintaining my old workstation when it comes to packages, libraries, and other services. So the IT head has kindly offered help if I were to get stuck somewhere but the task is mainly on me to move data over as I like.
I'm now at the stage where I need to properly rebuild the system and bring services online.
I’m trying to avoid just copying configs blindly and recreating years of accumulated cruft. I’d like to do this cleanly and follow best practices.
Current situation:
- Old OS (RHEL license expired)
- Fresh OS install (Rocky Linux) with all users and wheels transferred
- Licensed software set up by IT team
- All user data (/home) data rsynced over
- I have not copied over, /etc, system directories, or service configs
- Old system is still accessible if needed (for at least 2 weeks)
- Running gitlab server in docker for tracking progress
- Have many python environments etc
- Running several open source projects for my work that use those environments, some of which have databases for custom entries.
Goals:
- Rebuild services cleanly rather than transplanting configs
- Avoid subtle breakage from mismatched versions
- Improve directory structure where possible
- Ensure permissions and ownership are correct
- Implement proper backups before going fully live
Questions:
- What order would you recommend for rebuilding?
- Would you ever copy configs from /etc selectively, or always rebuild from scratch?
- For databases, do you prefer logical dumps (mysqldump/pg_dump) over copying raw data directories if versions match?
- Any common pitfalls you’ve seen in migrations like this?
- If you were doing this today, would you containerize during the rebuild or keep it traditional?
Please let me know if you need further info? Thanks
3
u/RippedTarsier Feb 19 '26
There's no set answer to any of these questions IMO. Experience drives a lot of the individual decisions.
7
u/tyami94 Feb 20 '26
Whatever you do, this time document the hell out of it. I put off rebuilding my system for years because it was undocumented. Fucked up recently and had to bite the bullet. This time I've been documenting absolutely everything in markdown, config changes, packages installed (and why), services enabled, etc. this has already been immensely helpful
5
u/biblicalrain Feb 19 '26
Two cent opinion here.
2
u/deep-sea-savior Feb 19 '26
2. I would redo configs from scratch while referencing the old configs. We had to migrate systems from RH7 to RH8 and we were surprised as to how many differences there were in configs. In fact, identical config files were the exception, not the norm. I imagine you’ll run into the same issue with Rocky.
4. Pitfalls: SELinux, if it applies. Install the selinux troubleshooting tools (I forgot the package name off the top of my head) and check for errors frequently via journald. Leave room to expand partitions; I found that dnf used much more space in /var/cache (I may not have that exactly right) than yum, having space to expand came in very handy. Have you considered “Ansible-izing” your config? This way you have complete documentation of all system changes.
Good luck.
2
u/clymber Feb 19 '26
One of the things I do is copy over the /etc directory into something like ~/old_etc so I always have at least a copy of the system configuration.
There's always something you forget after the old machine is shut down so being able to at least look has helped me.
After some time go ahead and wipe that directory.
5
u/jaymef Feb 19 '26
spend the time to rebuild it from the ground up using something like ansible or nix so you can reproduce it
2
u/FarToe1 Feb 20 '26
I do this stuff a lot (several hundred now), and mostly Centos/Rocky -> Rocky/Debian. Yours sounds bare metal vs a vm so it's a bit different but not much.
Your process looks pretty sound. You're right not to copy /etc over, but do keep an archive tarball of /etc from your old server. Sometimes stuff in /etc/httpd or any of the extra services can be useful later if you forget stuff.
/opt/gitlab can probably be copied over as it is and try it. It'll need the relevant systemd gitlab .service file. You could equally choose to install new and do a migration, their site will have guides.
Databases - this is something I do A LOT of, mostly mariadb which is the rocky default. Large ones (TB+) we keep on a second virtual hdd and we copy the vmdk over to the new vm, and a new version of maria exists there which slots right in. (Starting one of these in 10 minutes). Small ones - use mysqldump and restore (maria have a multi threaded tool that makes it quicker), but setup maria properly on the new machine first, especially to prevent ibdata1 growth. For medium ones (10G+), I tend to use mariadb-backup which does it at file level, which is faster than a dump. A lot depends on your downtime options. Don't rely on copying just the directory unless you've prepared the dir first. Postgres I don't know.
Containerising or not has pros and cons. For things like gitlab it can make life a lot easier with few downsides. For things like maria I like to have them native, but a lot depends on your personal choice, willingness to learn and the scale.
1
u/Reversi8 Feb 19 '26
Just copying things over will be a mess, what I would try to do is rebuild things using IaC and/or in containers so it can be easily ported over in future.
1
u/fubes2000 Feb 19 '26
If you're using the machine as a local development/testing environment you should strongly consider installing backing services [databases, caches, queues, etc] via containers. This will allow you to pin the versions to match actual deployment/production versions and not have to descend into package pinning hell on the system itself. This has the added benefit of being extremely portable and able to easily support parallel installations, if necessary.
As for the app dev itself, it's up to you to decide which torture is preferable: python venvs or wrangling code changes into python container executions.
1
u/AdrianTeri Feb 20 '26 edited Feb 20 '26
What you are asking is for is a continuous "rebuild" of your Os and it's offerings when every new version(including minor ones) are dropped.
This is NOT a "one time" or even seasonal thing. Fastest way to get everything up and running is to have a latest re-build or "baked" image which you just log into. The saying goes it should faster to re-build than troubleshoot issues.
For both data & databases(you are asking about dumps or copying dirs) I suspect you aren't doing 3-2-1 backups. Please get this done ASAP even faster than the above re-building of things.
Edits/Addendums: Also there are logs. It's "something else" to address.
1
u/Marelle01 Feb 22 '26
Switch to containers so you don't have to do all this again next time.