Skip to content

Instantly share code, notes, and snippets.

@gldraphael
Created November 29, 2025 15:26
Show Gist options
  • Select an option

  • Save gldraphael/3b61249c21232b38cf6f320a04b1f903 to your computer and use it in GitHub Desktop.

Select an option

Save gldraphael/3b61249c21232b38cf6f320a04b1f903 to your computer and use it in GitHub Desktop.
Backing up images on ghost while migrating servers
# 1. Connect to the old cluster
# and take a copy of the old files
kubectl exec -it deploy/ghost -- /bin/ghost
cd ~
cp -nr /var/lib/ghost/content .
# Delete unnecessary files before gzipping
# Be sure to remove .tar.gz files in particular
# In most cases, you probably only need content/images
tar -czf v30-2025-11-29-backup.tar.gz content/
exit
kubectl cp ghost-podsha:/root/v30-2025-11-29-backup.tar.gz v30-2025-11-29-backup.tar.gz
# 2. Connect to the new cluster
# and update ghost to use the new files
kubectl cp v30-2025-11-29-backup.tar.gz ghost-podsha:/root/v30-2025-11-29-backup.tar.gz
kubectl exec -it deploy/ghost -- /bin/bash
cd ~
tar -xf v30-2025-11-29-backup.tar.gz
rmdir /var/lib/ghost/content/images
cp -r content/images/ /var/lib/ghost/content/images
cd /var/lib/ghost/content
chown -R node:node images
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment