Migration from Bare Metal FOG
This guide covers migrating from a bare metal FOG installation to FOG Docker.
Overview
Migrating from bare metal FOG to FOG Docker involves:
- Exporting your existing FOG database
- Configuring FOG Docker with migration settings
- Importing the database automatically
- Verifying the migration
Prerequisites
- Existing bare metal FOG installation
- Access to the FOG database
- FOG Docker environment set up
- Sufficient disk space for database export
Migration Process
Step 1: Export Database from Bare Metal FOG
On your existing bare metal FOG server:
# Create a complete database dump
mysqldump --single-transaction --routines --triggers --databases fog > FOG_MIGRATION_DUMP.sql
# Verify the dump file was created
ls -la FOG_MIGRATION_DUMP.sql
# Check the dump file size (should be several MB)
du -h FOG_MIGRATION_DUMP.sql
Important: The dump file must be named exactly FOG_MIGRATION_DUMP.sql for automatic detection.
Step 2: Transfer Database Dump
Copy the database dump to your Docker host:
# Using SCP
scp FOG_MIGRATION_DUMP.sql user@docker-host:/path/to/fog-docker/
# Using rsync
rsync -avz FOG_MIGRATION_DUMP.sql user@docker-host:/path/to/fog-docker/
# Using USB drive or other method
# Copy FOG_MIGRATION_DUMP.sql to your Docker host
Step 3: Configure FOG Docker for Migration
- Enable migration in your
.envfile:# Enable database migration FOG_DB_MIGRATION_ENABLED=true # Optional: Force migration over existing data # FOG_DB_MIGRATION_FORCE=true - Mount the dump file in
docker-compose.yml:services: fog-server: environment: - FOG_WEB_HOST=${FOG_WEB_HOST} - FOG_HTTP_PROTOCOL=${FOG_HTTP_PROTOCOL} - FOG_INTERNAL_HTTPS_ENABLED=${FOG_INTERNAL_HTTPS_ENABLED} - FOG_APACHE_EXPOSED_PORT=${FOG_APACHE_EXPOSED_PORT} - FOG_DB_MIGRATION_ENABLED=${FOG_DB_MIGRATION_ENABLED} - FOG_DB_MIGRATION_FORCE=${FOG_DB_MIGRATION_FORCE} ports: - "${FOG_APACHE_EXPOSED_PORT:-8080}:80" volumes: - ./FOG_MIGRATION_DUMP.sql:/opt/migration/FOG_MIGRATION_DUMP.sql:ro # ... other volumesRequired .env variables:
FOG_WEB_HOST=fog.example.com FOG_HTTP_PROTOCOL=https FOG_INTERNAL_HTTPS_ENABLED=false FOG_APACHE_EXPOSED_PORT=8080 FOG_DB_MIGRATION_ENABLED=true FOG_DB_MIGRATION_FORCE=false
Step 4: Start FOG Docker
# Start the containers
docker compose up -d
# Monitor the migration process
docker compose logs -f fog-server
The container will automatically:
- Detect the migration dump file
- Import the database
- Remove the dump file after successful import
- Continue with normal FOG setup
Migration Safety Features
Automatic Safety Checks
- Migration is disabled by default (
FOG_DB_MIGRATION_ENABLED=false) - Existing database protection: If FOG database already exists, migration is skipped
- Force migration option: Use
FOG_DB_MIGRATION_FORCE=trueto override safety checks - Automatic cleanup: Dump file is removed after successful import
Migration Environment Variables
| Variable | Description | Default | Required |
|---|---|---|---|
FOG_DB_MIGRATION_ENABLED | Enable database migration | false | Yes |
FOG_DB_MIGRATION_FORCE | Force migration over existing data | false | No |
Additional Configuration Variables
| Variable | Description | Example | Default |
|---|---|---|---|
FOG_WEB_HOST | New FOG server hostname/IP | 192.168.1.100 | Required |
FOG_STORAGE_HOST | Storage node hostname/IP | 192.168.1.100 | FOG_WEB_HOST |
FOG_TFTP_HOST | TFTP server hostname/IP | 192.168.1.100 | FOG_WEB_HOST |
FOG_WOL_HOST | Wake-on-LAN server hostname/IP | 192.168.1.100 | FOG_WEB_HOST |
FOG_HTTP_PROTOCOL | Protocol (http/https) | https | http |
Post-Migration Steps
1. Verify Database Import
# Check if migration was successful
docker exec fog-server mysql -u root -p$FOG_DB_ROOT_PASSWORD -e "USE fog; SHOW TABLES;"
# Check for your existing hosts
docker exec fog-server mysql -u root -p$FOG_DB_ROOT_PASSWORD -e "USE fog; SELECT hostname, mac FROM hosts LIMIT 10;"
2. Update Network Configuration
Update your FOG Docker configuration to match your network:
# Update .env file with your network settings
FOG_WEB_HOST=your-new-fog-server-ip
FOG_STORAGE_HOST=your-new-fog-server-ip
FOG_TFTP_HOST=your-new-fog-server-ip
FOG_WOL_HOST=your-new-fog-server-ip
3. Update DHCP Configuration
Update your DHCP server to point to the new FOG Docker server:
DHCP Option 66 (Next Server): your-new-fog-server-ip DHCP Option 67 (Boot File):
- BIOS:
undionly.kpxe - UEFI:
ipxe.efi
4. Test Client Connectivity
- Test web interface:
http://your-new-fog-server-ip/fog - Test PXE boot: Boot a client machine
- Test image operations: Capture or deploy an image
5. Update Client Registrations
If your FOG server IP changed, you may need to:
- Re-register existing clients via PXE boot
- Update client configurations if they have hardcoded IPs
- Verify client communication with the new server
Troubleshooting Migration
Common Issues
Migration Not Starting
Symptoms: Container starts but no migration occurs Solutions:
- Check migration is enabled:
grep FOG_DB_MIGRATION_ENABLED .env - Verify dump file is mounted:
docker exec fog-server ls -la /opt/migration/ - Check file permissions:
ls -la FOG_MIGRATION_DUMP.sql
Database Already Exists Error
Symptoms: Migration skipped due to existing database Solutions:
- Use force migration:
FOG_DB_MIGRATION_FORCE=true - Or remove existing database:
docker compose down docker volume rm fog-docker_fog-db-data docker compose up -d
Import Errors
Symptoms: Database import fails with errors Solutions:
- Check dump file integrity:
head -20 FOG_MIGRATION_DUMP.sql tail -20 FOG_MIGRATION_DUMP.sql - Verify MySQL compatibility:
# Check FOG version compatibility grep "FOG" FOG_MIGRATION_DUMP.sql | head -5 - Check container logs:
docker compose logs fog-server | grep -i error
Debug Commands
# Check migration status
docker exec fog-server ls -la /opt/migration/
# Check database contents
docker exec fog-server mysql -u root -p$FOG_DB_ROOT_PASSWORD -e "USE fog; SHOW TABLES;"
# Check FOG configuration
docker exec fog-server cat /opt/fog/config/fog.config
# Check container logs
docker compose logs fog-server
Migration Best Practices
Before Migration
- Backup your existing FOG server completely
- Document your current FOG configuration
- Test FOG Docker in a lab environment first
- Plan for network changes (IP addresses, DNS, etc.)
During Migration
- Use a maintenance window for the migration
- Monitor the migration process closely
- Keep the original FOG server running until migration is verified
- Test all functionality before decommissioning the old server
After Migration
- Verify all hosts are accessible in the new system
- Test image capture and deployment
- Update documentation with new server details
- Monitor system performance for any issues
Rollback Plan
If migration fails or issues arise:
- Stop FOG Docker:
docker compose down -
Restore original FOG server from backup
-
Update DHCP to point back to original server
- Investigate and fix issues before retrying migration
Advanced Migration Scenarios
Large Database Migration
For large FOG installations:
# Compress the dump file
gzip FOG_MIGRATION_DUMP.sql
# Update docker-compose.yml to mount compressed file
volumes:
- ./FOG_MIGRATION_DUMP.sql.gz:/opt/migration/FOG_MIGRATION_DUMP.sql.gz:ro
Multi-Server FOG Migration
If migrating from a distributed FOG setup:
- Export from master server only
- Update storage node configurations in FOG Docker
- Migrate image files separately if needed
- Update client configurations for new server locations
Next Steps
After successful migration:
- Configuration Guide - Optimize FOG Docker configuration
- Network Boot Setup - Verify PXE and HTTPBoot configuration
- Troubleshooting Guide - Address any post-migration issues