# r630-01 Migration Plan - VMIDs 100-130 and 7800-7811

**Date:** 2025-01-20  
**Status:** Plan Ready  
**Issue:** Storage capacity limits migration options

---

## Storage Requirements

### VMIDs 100-130 (7 containers)
**Total:** 96 GB
- 100: 10 GB
- 101: 10 GB
- 102: 2 GB
- 103: 8 GB
- 104: 8 GB
- 105: 8 GB
- 130: 50 GB

### VMIDs 7800-7811 (5 containers)
**Total:** 210 GB
- 7800: 50 GB
- 7801: 50 GB
- 7802: 30 GB
- 7810: 50 GB
- 7811: 30 GB

### Combined Total
**306 GB required**

---

## r630-01 Storage Available

| Storage | Type | Available |
|---------|------|-----------|
| thin1 | lvmthin | 208 GB |
| local-lvm | lvmthin | 200 GB |
| local | dir | 536 GB |
| **Total** | | **944 GB** |

---

## Migration Challenge

**Problem:** Direct migration fails because:
1. Source VMs use thin1/thin4 storage on r630-02
2. These storage names don't exist on r630-01 in the same way
3. Proxmox migration requires compatible storage or backup/restore

**Solution Options:**
1. Use backup/restore method
2. Migrate to available storage (thin1 + local-lvm)
3. Distribute VMs across multiple storage pools

---

## Recommended Migration Plan

### Option 1: Migrate VMIDs 100-130 to thin1 (96 GB)
- ✅ Fits in thin1 (208 GB > 96 GB)
- ✅ 112 GB remaining on thin1

### Option 2: Migrate VMIDs 7800-7811 to local-lvm (210 GB)
- ✅ Fits in local-lvm (200 GB... wait, 210 GB > 200 GB)
- ⚠️ Requires local-lvm + local or just local

### Option 3: Mixed Storage (Recommended)

**Phase 1: VMIDs 100-130 → thin1**
- Storage: thin1 (208 GB available)
- Required: 96 GB
- Margin: 112 GB

**Phase 2: VMIDs 7800-7811 → local storage**
- Storage: local (536 GB available) or local-lvm + local
- Required: 210 GB
- Available: 536 GB (directory storage)

---

## Migration Method

Since direct migration fails due to storage name differences, use **backup/restore method**:

### Steps for Each VM

1. **Create backup on source node**
   ```bash
   # On r630-02
   vzdump <vmid> --storage local --compress gzip --mode stop
   ```

2. **Restore on target node**
   ```bash
   # On r630-02 (can restore to remote node)
   pct restore <vmid> /var/lib/vz/dump/vzdump-lxc-<vmid>-*.tar.gz \
       --storage <target-storage> \
       --target r630-01
   ```

3. **Delete from source**
   ```bash
   pct destroy <vmid>
   ```

---

## Storage Distribution Plan

### Recommended Distribution

**thin1 (208 GB):**
- VMIDs 100-130: 96 GB
- Remaining: 112 GB

**local-lvm (200 GB) + local (536 GB):**
- VMIDs 7800-7811: 210 GB
- Use local storage (536 GB > 210 GB)

---

## Migration Commands

### VMIDs 100-130 to thin1

```bash
# On r630-02
for vmid in 100 101 102 103 104 105 130; do
    # Backup
    vzdump $vmid --storage local --compress gzip --mode stop
    
    # Restore to r630-01 with thin1 storage
    BACKUP=$(ls -t /var/lib/vz/dump/vzdump-lxc-$vmid-*.tar.gz | head -1)
    pct restore $vmid $BACKUP --storage thin1 --target r630-01
    
    # Delete from source
    pct destroy $vmid
done
```

### VMIDs 7800-7811 to local storage

```bash
# On r630-02
for vmid in 7800 7801 7802 7810 7811; do
    # Backup
    vzdump $vmid --storage local --compress gzip --mode stop
    
    # Restore to r630-01 with local storage
    BACKUP=$(ls -t /var/lib/vz/dump/vzdump-lxc-$vmid-*.tar.gz | head -1)
    pct restore $vmid $BACKUP --storage local --target r630-01
    
    # Delete from source
    pct destroy $vmid
done
```

---

## Alternative: Use API Migration

If we can resolve the storage issue, API migration would be faster:

```bash
# This currently fails due to storage name mismatch
pvesh create /nodes/r630-02/lxc/<vmid>/migrate \
    --target r630-01 \
    --online 0
```

---

## Summary

**Total Storage Needed:** 306 GB  
**Available on r630-01:** 944 GB  
**Status:** ✅ Sufficient storage available  

**Recommended Approach:**
- VMIDs 100-130 → thin1 storage (96 GB)
- VMIDs 7800-7811 → local storage (210 GB)

**Migration Method:** Backup/Restore (required due to storage name differences)

---

**Last Updated:** 2025-01-20  
**Status:** Plan Ready - Backup/Restore Method Required
