banner image- migrate big wordpress website with ssh

How to Migrate Large WordPress Sites (5GB-300GB+) Using SSH and WP-CLI

⚠️ Disclaimer: This is not the kiddie pool. This is the deep end. If you jump in, at least pretend you know how to swim.

I love the Updraft Plus migration plugin. I use it in every possible place to save time and effort. I have also used All in One WordPress Migration, Duplicator and all the available plugins of WordPress repository.

Migrating large WordPress websites can be a nightmare. I’ve learned this the hard way after working with sites ranging from 5GB to massive 300GB+ installations. Traditional migration plugins simply can’t handle these enormous sites – they timeout, crash, or take forever to complete.

After countless migrations at InstaWP, I’ve developed a bulletproof method using SSH, WP-CLI, and strategic file compression that works flawlessly for sites of any size. Vikas Singhal has a big contribution here. Because I learned the process from him. It was an internal training video. I have changed the process a bit according to my liking. Here’s exactly how I do it.

Why Traditional Migration Methods Fail for Large Sites

Most WordPress migration plugins are designed for small to medium sites. When you’re dealing with:

  • Sites over 5GB in size
  • Thousands of media files
  • Large databases with millions of rows
  • Limited server resources or timeout restrictions

…you need a more robust approach. That’s where command-line tools like SSH and WP-CLI become invaluable.

My Proven 6-Step Migration Process

Step 1: Login to Source Server via SSH and Create Strategic Zips

First, I connect to the source server and analyze what I’m working with:

Check file sizes to understand the scope

# Check file sizes to understand the scope
du -sh *
du -sh wp-content/uploads/*

For the uploads folder (usually the largest), I create 2GB zip files to make transfers manageable:

# Navigate to wp-content directory
cd wp-content/uploads

# Create organized 2GB zips - I keep track on paper!
tar -czvf uploads-part1.tar.gz 2019/ 2020/
tar -czvf uploads-part2.tar.gz 2021/ 2022/
tar -czvf uploads-part3.tar.gz 2023/ 2024/

# For the main wp-content (excluding uploads to avoid duplication)
cd ../
tar -czvf wp-content-core.tar.gz themes/ plugins/ --exclude=uploads/

Pro Tip: I always keep a handwritten list tracking which files go into which zip. This saves hours of confusion during the upload process.

Step 2: Export the Database Using WP-CLI

WP-CLI makes database operations incredibly smooth:

# Export the entire database
wp db export backup-database.sql

# Check the export size
ls -lh backup-database.sql

# Optional: Compress the database export for faster transfer
gzip backup-database.sql

For extra large databases, you might want to exclude certain tables:

# Export without logs and cache tables (if using caching plugins)
wp db export backup-database.sql --exclude_tables=wp_actionscheduler_logs,wp_wc_webhooks,wp_woocommerce_log

Step 3: Download Files via SFTP Using FileZilla

This is where organization becomes crucial. In FileZilla:

  1. Create a local folder structure matching your zip organization
  2. Download systematically: Start with database, then core files, then upload chunks
  3. Verify file integrity: Check file sizes match what you expect

I organize my local downloads like this:

migration-project/
├── database/
   └── backup-database.sql.gz
├── wp-content-core/
   └── wp-content-core.tar.gz
└── uploads/
    ├── uploads-part1.tar.gz
    ├── uploads-part2.tar.gz
    └── uploads-part3.tar.gz

Step 4: Upload to Destination Server via SFTP

Using the same organized approach, I upload everything to the new server. The key is maintaining the same structure to avoid confusion.

FileZilla Pro Tips:

  • Use queue management for large transfers
  • Enable transfer resume in case of interruptions
  • Monitor transfer speeds and adjust concurrent connections if needed

Step 5: Login to New Server via SSH and Extract Files

Once everything is uploaded:

# Navigate to WordPress root directory
cd /path/to/wordpress

# Extract core wp-content files
tar -xzvf wp-content-core.tar.gz

# Extract uploads in parts
cd wp-content/uploads/
tar -xzvf uploads-part1.tar.gz
tar -xzvf uploads-part2.tar.gz  
tar -xzvf uploads-part3.tar.gz

# Set proper permissions
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

# Clean up zip files to save space
rm *.tar.gz

Step 6: Import Database and Configure WP-CLI

Since I work with InstaWP (a managed WordPress platform), the database and user credentials are automatically created, saving me about 10 minutes per migration. I simply update the wp-config.php with the provided credentials.

For the database import:

# Import the database
wp db import backup-database.sql.gz

# Update site URLs (crucial step!)
wp search-replace 'https://oldsite.com' 'https://newsite.com' --dry-run
wp search-replace 'https://oldsite.com' 'https://newsite.com'

# Create admin user for immediate access
wp user create admin admin@newsite.com --role=administrator
wp user update admin@newsite.com --user_pass=SecurePassword123

# Flush rewrite rules
wp rewrite flush

# Update file permissions if needed
wp core update-db

Essential WP-CLI Commands for Large Site Migrations

Here are additional commands I frequently use during migrations:

# Check WordPress version and update if needed
wp core version
wp core update

# Verify database integrity
wp db check

# Search and replace with specific table (for targeted updates)
wp search-replace 'old-domain.com' 'new-domain.com' --all-tables

# Clear any caching
wp cache flush
wp transient delete --all

# Check for broken plugins
wp plugin status
wp plugin activate --all

# Verify media library
wp media regenerate --yes

Troubleshooting Common Issues

Large File Upload Timeouts

If you encounter PHP upload limits:

# Increase PHP limits temporarily
wp config set WP_MEMORY_LIMIT 1000M
wp config set MAX_EXECUTION_TIME 1000

Database Import Failures

For very large databases:

# Import with increased buffer size
wp db import backup-database.sql --skip-optimization

Permission Issues

Fix WordPress file permissions:

# Set correct ownership (adjust user/group as needed)
chown -R www-data:www-data /path/to/wordpress

# Set directory permissions
find /path/to/wordpress -type d -exec chmod 755 {} \;

# Set file permissions  
find /path/to/wordpress -type f -exec chmod 644 {} \;

Why This Method Works for Sites Up to 300GB+

This approach has several advantages:

  1. No PHP timeouts: Command-line operations aren’t subject to web server limitations
  2. Resumable transfers: If something fails, you can restart from where you left off
  3. Better resource management: You control memory usage and processing
  4. Organized approach: The systematic zipping prevents confusion and errors
  5. Professional reliability: This is production-grade migration methodology

Performance Tips for Massive Migrations

  • Use compression: Always compress database exports and large file groups
  • Monitor server resources: Keep an eye on disk space during extraction
  • Plan for downtime: Large sites need maintenance mode during migration
  • Test thoroughly: Always verify the migration in a staging environment first

Final Thoughts

Migrating large WordPress sites doesn’t have to be stressful. With the right tools (SSH, WP-CLI, and FileZilla) and a systematic approach, even 300GB+ sites can be moved reliably.

The key is organization, patience, and using professional-grade tools instead of trying to force plugins to handle workloads they weren’t designed for.


Need Help Migrating Your WordPress Site?

Whether your site is 5GB or 500GB, I can help you migrate it safely and efficiently using these proven methods. I’ve successfully migrated hundreds of WordPress sites of all sizes.

Comment below with your migration challenges, or contact me on Twitter for professional WordPress migration services.