07 November 2025

Migrating Proxmox Containers to a Different Server

 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


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

  1. Create a destination for proxmox backups on the drives to move over:
    • zfs create storage/encrypted/proxmox
    • mkdir /storage/encrypted/proxmox/backups
  2. Add this backup destination to Proxmox:
    • Datacenter -> Storage
    • Add -> Directory
    • Set "Content" to "Backups"
  3. 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
  4. Disable Auto-Start
    • Select "Options"
    • Select "Start at boot"
    • Click "Edit"
    • Uncheck and click "OK"
  5. Repeat 3 + 4 for each LXC that you are migrating
  6. 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

  1. Shutdown both the old and new server
  2. Move the HDDs over to the new server
  3. Turn on the new server


Restore LXC containers

  1. Import the ZPool
    • zpool import storage
  2. Add the backup destination to Proxmox
    • Datacenter -> Storage
    • Add -> Directory
  3. Restore the LXC
    1. Select the LXC backup that you want to restore
    2. Click "Restore"
    3. Edit the CT ID if desired
    4. Click "Restore"
  4. 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