Hello, is there a proper step-by-step how to migrate my mailinabox insance from the last version 0.57 on a 18.04 system to the new 0.60 on a 22.04.
I was reading this old thread about setting up a new instance and just “putting the backup in” - but I have no idea how to do this. Ubuntu Migration Plan - #17 by Eliter
Is there anybody who can help me out with some hints?
It is important to me, that I can keep my current configuration (of DNS, Mailboxes, Users) as well as the data.
Generally speaking this will largely depend on what VPS you have.
Prerequisite - ensure your on v0.51 of MiaB or later.
Step 1) Create a new virtual machine (droplet, VPS, compute ec2, etc) during that installation select ubuntu 22.04 as the operating system. DO NOT DELETE YOUR OLD SERVER
Step 2) get your /home/user-data/ folder over to the new server, how ever which way you want to do this (duplicity backup/restore, tar -czvf user-data.tar.gz /home/user-data/ then moving that file via SCP and restoring with tar -xvf user-data.tar.gz, rsync, etc, etc…
Step 4) reconfigure your IP address to be that of the existing server you had previously. This is probably going to different for every service out there so you might have to google how to do this with whatever VPS cloud hosting company your using.
I am specifically interested in the Step 2
When doing so. (e.g. get all files down to my pc from my instance and the re-upload them to the new instance via SCP) that would include all necessary files/configurations/information such as users, emails, dns records? Or do I need something else? I was reading of adding the backups or so.
For Step 4) that would mean, that I need to change for every domain I have the IP address at the different hosters. I guess thats doable for me
I think that the steps are a bit out of order and a major step is missing here. I really really recommend following the official guide for moving your box:
However there are some additional steps to take here since our goal is slightly different than what is presented in that guide.
WE WANT TO PRESERVE OUR IP ADDRESS
So in the end we will not be updating Glue records but instead want to make a snapshot of our droplet (using Digital Ocean terms) and then restore that to the original droplet to preserve our IP address…
But if I’m reinstalling my OS, that’s just basicly… deleting my old server right? or am I missing some important detail here. So I think I’m in the same boat here with the new IP. Guess I’ll just contact support there first, to see if maybe they can transfer the IP address at some point.
It is all in the context. But note that was not my comment. That poster was suggesting to rsync the /home/user-data/ directory as an alternative to restoring the backup. I agree that is an easier method to proceed - IF you have a good knowledge of what you are doing and using rsync.
Digital Ocean is the default provider suggested by this project originally, so my answers tend to fall within the parameters of using Digital Ocean.
Digital Ocean offers the ability to create snapshots and to restore those snapshots to a different VM within the same data center. So this advice is applicable if moving within the DO infrastructure.
Spin up a new droplet installing Ubuntu 22.04
Install MiaB
rsync your data backup from the original droplet to some directory out of the way on the new droplet. (Alternatively, as the comment you’re referring to was suggesting, use rsync to move your data - note this is for experienced users only!)
Restore your backup.
Once confirmed that all is good, make a snapshot of the new droplet.
Then reinstall your old droplet with the snapshot from the new droplet.
Run sudo mailinabox from the command line to insure that all settings are correct.
Now you have migrated to Ubuntu 22 while retaining your original IP address.
Sadly no. They are quite a bad provider when it comes to features/functionality (or price) - I only use them, cause I had lots of coupons. Eventually when they run out, I will migrate to some other service, but till then, I will be using them, even if its more effort.
I mean, they offer a re-install but not putting snapshots from one instance to another. Snapshots can only be restored to the same instance, which is useless most of the time, only for complete recovery usefull)
Then unfortunately you’ll have to take the path that is more effort.
You’ll need to copy/download your backups (don’t forget the secret key!) to another vps or your PC, reinstall Ubuntu 22 and MiaB, then upload the backup and restore it. This path leads to more room for error, but it is the methodology used before restoring snapshots to a new droplet was a thing with DO.
If I create a new droplet on DO for the procedure you describe, how should I setup MAIB before saving it as a snapshot? Should I use the name I use on my current box? Or can I use a different name and change it when I restore my backups?
This is the procedure I followed when I migrated from 14.04 to 18.04. (Note: I have my backups on a separate volume that is attached to my droplet).
make final backup after disabling the ports to prevent incoming traffic
detach volume from droplets
reinstall new OS on droplet
install MIAB
reattach volume to droplet and fix links
restore backups
run sudo mailinabox
This worked very well but the advantage of your procedure is that you can wait with the final backup until the last minute, and have less downtime.
So I tried this guide and copied all my backup files to ~/copied
and my scret_key.txt to ~/secret_key.txt
Then I ran from ~ the following commands:
export PASSPHRASE=$(cat secret_key.txt)
mailserver@mailbox:~$ sudo -E duplicity restore --force file:///home/mailserver/copied/ /home/user-data/
and got following:
Synchronizing remote metadata to local cache…
Copying duplicity-full-signatures.somethingblablabla.sigtar.gpg to local cache.
GPGError: GPG Failed, see log below:
===== Begin GnuPG log =====
gpg: AES256.CFB encrypted data
gpg: encrypted with 1 passphrase
gpg: decryption failed: Bad session key
===== End GnuPG log =====
Could it be something with the GPG Versions?
Original:
mailserver@mailbox:~$ gpg --version
gpg (GnuPG) 2.2.4
libgcrypt 1.8.1
Double checking - will it be enough to do rsync -rlptgoD on the /home/user-data directory? My Nextcloud uses too much space and I don’t have enough space to generate the usual duplicity backup