Storage Migrations¶
Overview¶
Storage migrations involve moving data between storage backends or expanding storage capacity. This page covers common storage migration scenarios.
Local to S3 Migration¶
InfluxDB Local → S3¶
Scenario: Migrate from local disk to S3-compatible object storage
Benefits: - Virtually unlimited capacity - Lower cost per GB - Built-in replication - Separate compute from storage
Migration steps:
-
Prepare S3 bucket:
-
Backup current data:
-
Deploy new InfluxDB with S3:
-
Restore data:
-
Verify data:
-
Update clients (if endpoint changed):
Downtime: 15-30 minutes (depending on data size)
Loki Local → S3¶
Migration steps:
-
Prepare S3 bucket:
-
Option A: Cutover (accept data loss):
- Deploy new Loki with S3
- Point clients to new Loki
-
Old logs retained per retention policy
-
Option B: Dual instance (no data loss):
- Deploy second Loki with S3
- Update Alloy to send to both
- After retention period, decommission old Loki
Option B configuration:
// Send to both old and new Loki
loki.write "old" {
endpoint {
url = "http://old-loki:3100/loki/api/v1/push"
}
}
loki.write "new_s3" {
endpoint {
url = "http://new-loki:3100/loki/api/v1/push"
}
}
loki.source.journal "logs" {
forward_to = [
loki.write.old.receiver,
loki.write.new_s3.receiver,
]
}
After retention period (e.g., 30 days):
S3 Bucket Migration¶
Move to Different S3 Provider¶
Scenario: Migrate from one S3-compatible storage to another
Steps:
-
Create bucket on new provider:
-
Sync data (if supported):
-
Update InfluxDB configuration:
-
Restart InfluxDB:
-
Verify:
Expanding Local Storage¶
Add New Disk¶
Scenario: Local storage running out of space
Steps:
-
Add physical disk: Install new disk in server
-
Create filesystem:
-
Stop services:
-
Move data:
-
Update mounts:
-
Fix permissions:
-
Start services:
-
Verify:
Extend LVM Volume¶
If using LVM:
# Add physical volume
pvcreate /dev/sdb1
# Extend volume group
vgextend vg_monitoring /dev/sdb1
# Extend logical volume
lvextend -l +100%FREE /dev/vg_monitoring/lv_monitoring
# Resize filesystem
resize2fs /dev/vg_monitoring/lv_monitoring
NFS Migration¶
Local to NFS¶
Scenario: Migrate to network-attached storage
Steps:
-
Prepare NFS share:
-
Mount on client:
-
Stop services and migrate:
-
Update systemd units:
-
Update fstab:
-
Start services:
Data Retention Changes¶
Reduce Retention to Free Space¶
If running out of space, reduce retention:
InfluxDB:
# Update bucket retention
influx bucket update \
--name telegraf \
--retention 7d # Reduced from 30d
Loki:
Redeploy:
Old data will be deleted according to new retention policy.
Migration Verification¶
Post-Migration Checklist¶
- [ ] Services running without errors
- [ ] Data accessible via queries
- [ ] No permission errors in logs
- [ ] Storage usage as expected
- [ ] Performance acceptable
- [ ] Clients connecting successfully
- [ ] Dashboards showing data
- [ ] Backup/restore tested
Query Test¶
InfluxDB:
influx query 'from(bucket: "telegraf")
|> range(start: -1h)
|> filter(fn: (r) => r["_measurement"] == "cpu")
|> count()'
Loki:
curl -G "http://localhost:3100/loki/api/v1/query" \
--data-urlencode 'query={service_type="fail2ban"}' \
--data-urlencode 'limit=5'
Performance Check¶
Disk I/O:
Network (if NFS/S3):
Query latency:
Rollback Procedures¶
S3 → Local Rollback¶
- Keep local backup until verified
- Update configuration back to local
- Restore from backup if needed
- Restart services
NFS → Local Rollback¶
- Copy data back to local disk
- Update systemd unit files
- Update fstab
- Restart services
Best Practices¶
- Always backup: Before any storage migration
- Test first: Use test environment
- Verify twice: Check data before deleting source
- Plan downtime: Communicate maintenance window
- Monitor closely: Watch for issues post-migration
- Keep backups: Don't delete old data immediately
- Document changes: Update infrastructure docs
- Verify performance: Ensure migration didn't degrade performance