Here are the steps that I used to migrate from my Proxmox containers from my Dell r730xd to my Lenovo TS140
New (old) Server Setup
- Update Lenovo TS140 firmware
- Make sure it is set to boot UEFI first (not Legacy first)
- Install Proxmox (https://www.proxmox.com/en/downloads/proxmox-virtual-environment/iso)
- Run Post Install Script:
- bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/post-pve-install.sh)"
Migrate LXC containers and ZPool drives
As I was going to move my drives containing my main ZPool, I decided that the easiest way to migrate my containers was to back them up to the drives themselves. This way after moving the drives over and importing the array, I can simply restore them from the backups on the new server.
Backup Existing LXC containers
- Create a destination for proxmox backups on the drives to move over:
- zfs create storage/encrypted/proxmox
- mkdir /storage/encrypted/proxmox/backups
- Add this backup destination to Proxmox:
- Datacenter -> Storage
- Add -> Directory
- Set "Content" to "Backups"
- Create backup of each LXC that you want to migrate
- Choose the LXC
- Click "Shutdown"
- Select "Backup"
- Click "Backup now"
- Select your backup directory
- Click "Backup"
- Make note of any bind mount points that you will need to recreate
- Disable Auto-Start
- Select "Options"
- Select "Start at boot"
- Click "Edit"
- Uncheck and click "OK"
- Repeat 3 + 4 for each LXC that you are migrating
- Unmount and export the ZPool
- zpool export storage
Recreate Users and Groups
For file permissions to transfer seamlessly, it is best to have the same users and groups on both servers
- Old Server
- View current users
- cat /etc/passwd
- View current groups
- cat /etc/group
- Note the user/group name as well as its ID
- View the mapping files
- cat /etc/subuid
- cat /etc/subgid
- New Server
- For each needed group run:
- groupadd -g <gid_number> <group_name>
- For each needed user run:
- useradd -u <uid_number> -g <gid_number> <username>
- Set users primary group
- usermod -g <primary_group> <username>
- Add user to group(s)
- usermod -aG <group1>,<group2> <username>
- Update mapping files
- vi /etc/subuid
- vi /etc/subgid
Physical Changes
- Shutdown both the old and new server
- Move the HDDs over to the new server
- Turn on the new server
Restore LXC containers
- Import the ZPool
- zpool import storage
- Add the backup destination to Proxmox
- Datacenter -> Storage
- Add -> Directory
- Restore the LXC
- Select the LXC backup that you want to restore
- Click "Restore"
- Edit the CT ID if desired
- Click "Restore"
- Repeat step 3 for each LXC
Results
The containers spun up without issue and I didn't have to change any client configs!
Appendix
Sources
No comments:
Post a Comment