- Add LXC migration plan and quick-start guide - Add wave 1 and wave 2 migration results - Add lxc-docker-create.sh for container creation - Add fix-docker-apparmor.sh for AppArmor issues - Add comprehensive LXC migration guide 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
130 lines
3.6 KiB
Markdown
130 lines
3.6 KiB
Markdown
# VM to LXC Migration - Quick Start Guide
|
|
|
|
**Status**: Approved & Ready for Execution
|
|
**Last Updated**: 2025-01-12
|
|
|
|
## ✅ Confirmed Decisions
|
|
- **Networking**: Reuse existing IP addresses
|
|
- **Storage**: Fresh install + volume copy for Docker hosts
|
|
- **Timeline**: 4-6 weeks (expected to accelerate)
|
|
- **GPU**: No GPU hardware - all services can migrate
|
|
|
|
## Migration Order (Risk-Based)
|
|
|
|
### Wave 1: docker-7days (111) - LOWEST RISK
|
|
**Goal**: Validate entire migration process
|
|
- Non-critical game server
|
|
- Docker-in-LXC test
|
|
- Build confidence
|
|
|
|
### Wave 2: docker-pittsburgh (114) + docker-vpn (105)
|
|
**Goal**: Regional/isolated Docker hosts
|
|
- Test VPN routing
|
|
- Regional services validation
|
|
|
|
### Wave 3: docker-sba (115) + docker-unused (117) + docker-home-servers (116)
|
|
**Goal**: Additional Docker infrastructure
|
|
- Use SBA maintenance windows
|
|
- Decommission unused if appropriate
|
|
|
|
### Wave 4: discord-bots (110) + databases-bots (112)
|
|
**Goal**: Application & database servers
|
|
- ⚠️ EXTRA CARE for database migration
|
|
- Full backups required
|
|
|
|
### Wave 5: docker-tdarr (113) + plex (107)
|
|
**Goal**: Media services (software transcoding)
|
|
- Monitor CPU usage
|
|
- Validate transcode performance
|
|
|
|
### Wave 6: docker-home (106) - MOST CRITICAL
|
|
**Goal**: Final critical infrastructure
|
|
- Migrate last after all confidence built
|
|
- Most important home services
|
|
|
|
## Keep as VMs
|
|
- **hass-io (109)**: HassOS requirement
|
|
- **ubuntu-template (100)**: Strategic flexibility
|
|
|
|
## LXC Container IDs (200-series)
|
|
|
|
| VM → LXC | Service | Wave |
|
|
|----------|---------|------|
|
|
| 111 → 211 | docker-7days | 1 |
|
|
| 114 → 214 | docker-pittsburgh | 2 |
|
|
| 105 → 205 | docker-vpn | 2 |
|
|
| 115 → 215 | docker-sba | 3 |
|
|
| 117 → 217 | docker-unused | 3 |
|
|
| 116 → 216 | docker-home-servers | 3 |
|
|
| 110 → 210 | discord-bots | 4 |
|
|
| 112 → 212 | databases-bots | 4 |
|
|
| 113 → 213 | docker-tdarr | 5 |
|
|
| 107 → 207 | plex | 5 |
|
|
| 106 → 206 | docker-home | 6 |
|
|
|
|
## Quick Commands
|
|
|
|
### Create LXC for Docker
|
|
```bash
|
|
pct create 2XX local:vztmpl/ubuntu-22.04-standard_22.04-1_amd64.tar.zst \
|
|
--hostname docker-7days-lxc \
|
|
--memory 4096 \
|
|
--cores 2 \
|
|
--net0 name=eth0,bridge=vmbr0,ip=10.10.0.TMP/24,gw=10.10.0.1 \
|
|
--storage local-lvm \
|
|
--rootfs local-lvm:32 \
|
|
--unprivileged 0 \
|
|
--features nesting=1,keyctl=1
|
|
|
|
pct start 2XX
|
|
pct enter 2XX
|
|
```
|
|
|
|
### Install Docker in LXC
|
|
```bash
|
|
apt update && apt upgrade -y
|
|
curl -fsSL https://get.docker.com -o get-docker.sh
|
|
sh get-docker.sh
|
|
apt install docker-compose-plugin -y
|
|
```
|
|
|
|
### Migrate Docker Volumes
|
|
```bash
|
|
# While VM running - initial sync
|
|
rsync -avz --progress root@VM_IP:/var/lib/docker/volumes/ root@LXC_IP:/var/lib/docker/volumes/
|
|
rsync -avz --progress root@VM_IP:/opt/docker/ root@LXC_IP:/opt/docker/
|
|
|
|
# During cutover - final sync with VM stopped
|
|
rsync -avz --progress --delete root@VM_IP:/var/lib/docker/volumes/ root@LXC_IP:/var/lib/docker/volumes/
|
|
```
|
|
|
|
### Cutover Process
|
|
1. Stop VM: `qm stop 111`
|
|
2. Reconfigure LXC to production IP
|
|
3. Start LXC: `pct start 211`
|
|
4. Validate services
|
|
5. Monitor for 48 hours
|
|
6. Keep VM stopped for rollback capability
|
|
|
|
### Rollback (if needed)
|
|
```bash
|
|
pct stop 211
|
|
qm start 111
|
|
```
|
|
|
|
## Next Immediate Steps
|
|
|
|
1. **Schedule Wave 1**: Pick maintenance window for docker-7days
|
|
2. **Build LXC 211**: Create first container
|
|
3. **Test & Migrate**: Execute Wave 1
|
|
4. **Document Learnings**: Refine process for Wave 2
|
|
|
|
## Full Documentation
|
|
See `/mnt/NV2/Development/claude-home/vm-management/lxc-migration-plan.md` for comprehensive details.
|
|
|
|
## Expected Benefits
|
|
- **~17GB RAM freed** (87% reduction in overhead)
|
|
- **5-10x faster backups/restores**
|
|
- **Near-instant container starts** (1-5 seconds)
|
|
- **Improved resource density**
|