Skip to main content

Linux Server Migration Checklist: Complete Guide

Published: August 21, 2013 Updated: May 25, 2026 Larry Qu 4 min read

Server Migration Overview

Server migration is a complex task that requires careful planning and execution.

Pre-Migration Preparation

1. Checklist Review

# Key files and directories to back up

# System configuration
/etc/passwd          # User accounts
/etc/shadow          # Password hashes
/etc/group           # User groups
/etc/sudoers         # Sudo privileges
/etc/hosts           # Hostname resolution
/etc/fstab           # Filesystem mounts
/etc/crontab         # Scheduled tasks
/etc/resolv.conf     # DNS configuration

# User configuration
~/.bashrc           # Bash configuration
~/.bash_profile     # Bash login configuration
~/.ssh/             # SSH keys
/root/.bashrc       # Root user configuration

# Application data
/data               # Data directory
/var/www/           # Web applications
/var/lib/mysql/     # MySQL data
/var/lib/postgresql/ # PostgreSQL data

# Logs (optional)
/var/log/           # System logs

2. Service Inventory

# List all running services
systemctl list-unit-files --type=service --state=enabled

# Or use the service command
service --status-all

# Record network connections
netstat -tuln > network_connections.txt
ss -tuln > ss_connections.txt

3. Disk Usage

# Check disk usage
df -h

# Check directory sizes
du -sh /var/*
du -sh /data/*

# Check inode usage
df -i

Data Backup

1. Backup with rsync

# Sync to local backup directory
rsync -avz --progress /data /backup/data/

# Sync to remote server
rsync -avz -e ssh /data user@remote:/backup/data/

# Incremental backup
rsync -avz --delete -e ssh /data user@remote:/backup/

2. Archive with tar

# Archive the entire system
tar -czvf backup.tar.gz \
    /etc \
    /var/www \
    /home \
    /opt \
    --exclude='/proc' \
    --exclude='/sys' \
    --exclude='/dev' \
    --exclude='/run' \
    --exclude='/tmp'

3. Database Backup

# MySQL backup
mysqldump -u root -p --all-databases > all_databases.sql

# Or specify a database
mysqldump -u root -p mydb > mydb.sql

# PostgreSQL backup
pg_dumpall -U postgres > all_postgres.sql

# MongoDB backup
mongodump --out /backup/mongodb/

Configuration Migration

1. SSH Configuration

# Copy SSH configuration
cp -r /home/.ssh /backup/.ssh
cp /etc/ssh/sshd_config /backup/sshd_config

# Set permissions
chmod 700 /backup/.ssh
chmod 600 /backup/.ssh/*

2. Nginx Configuration

# Backup Nginx configuration
cp -r /etc/nginx /backup/nginx

# Key files
/etc/nginx/nginx.conf
/etc/nginx/conf.d/
/etc/nginx/sites-enabled/

3. Docker Configuration

# List all containers
docker ps -a

# Export containers
docker export container_name > container.tar

# Copy volumes
docker run --rm -v myvolume:/data -v $(pwd):/backup alpine tar cvf /backup/volume.tar -C /data .

# Save images
docker save myimage:latest -o myimage.tar

Service Migration Steps

1. Stop Services

# Stop all services
systemctl stop nginx
systemctl stop mysql
systemctl stop php-fpm

# Or use
service nginx stop

2. Migrate Data

# Use rsync to migrate large data
rsync -avz --progress /data user@newserver:/data/

# Use netcat for fast transfer (same network)
# Target server
nc -l 9999 | tar xf - -C /data

# Source server
tar cf - /data | nc newserver 9999

3. Rebuild Services

# Install the same software on the new server
apt-get install nginx mysql-server php-fpm

# Restore configuration
cp /backup/nginx/* /etc/nginx/
cp /backup/ssh/sshd_config /etc/ssh/

4. Start Services

# Start services
systemctl start nginx
systemctl start mysql
systemctl enable nginx  # Enable on boot

Post-Migration Verification

1. Service Status

# Check all service status
systemctl status nginx
systemctl status mysql

# Check listening ports
ss -tuln | grep :80
ss -tuln | grep :3306

2. Log Check

# Check error logs
tail -f /var/log/nginx/error.log
tail -f /var/log/mysql/error.log

# Check system logs
journalctl -xe

3. Functionality Testing

# Test web service
curl -I http://localhost

# Test database connection
mysql -u root -p -e "SHOW DATABASES;"

# Test application
curl http://localhost/api/health

Migration Checklist Template

## Server Migration Checklist

### Pre-Migration
- [ ] Document current server configuration
- [ ] Back up all data
- [ ] Test backup integrity
- [ ] Notify users of migration window
- [ ] Prepare rollback plan

### During Migration
- [ ] Stop services
- [ ] Migrate data
- [ ] Configure new server
- [ ] Start services

### Post-Migration
- [ ] Verify services are running
- [ ] Test functionality
- [ ] Monitor performance
- [ ] Update DNS
- [ ] Notify users of completion

### Rollback
- [ ] Document issues
- [ ] Restore from backup
- [ ] Re-migrate
Tool Purpose
rsync File synchronization
Duplicati Backup tool
Bacula Enterprise backup
Docker Containerized migration
Ansible Automated configuration

Comments

👍 Was this article helpful?