How can I move my wordpress media files to new volume and use that for my existing site? As my Media file getting bigger.

I’ve taken extra 40 GB disk space with my droplet to store my all media files there and I wanted to access my existing media file from there and view them as per product images.

So I need to move my previous wp-content/upload media files to new the volume. Here you can see on the image I have 40 GB unused storage. All storage uses data

I wanted to move my existing file there and use them from that folder as I’m using from the main storage.

How can I move all data from main storage to new disk space? How can point that data so that there will be no problem to my product image view?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
May 14, 2024


Before proceeding, I would strongly recommend making sure that you have a backup of your Droplet, just in case, so that you can revert to a working version of your website if ever needed.

Once you have a backup, to move your WordPress media files to the new volume and use it for your existing site, you can follow these steps:

  1. Copy Existing Media Files to the New Volume: First, copy your existing uploads directory to the new volume.

    sudo rsync -avP /var/www/html/wp-content/uploads/ /mnt/volume_lon1_03/wp-content/uploads/
  2. Backup and Remove the Old uploads Directory: Backup your current uploads directory and then remove it.

    sudo mv /var/www/html/wp-content/uploads /var/www/html/wp-content/uploads.bak
  3. Unmount the New Volume: Unmount the new volume from its current mount point.

    sudo umount /mnt/volume_lon1_03
  4. Mount the New Volume to the Correct Path: Mount the new volume to the /var/www/html/wp-content/uploads directory.

    sudo mount /dev/sda /var/www/html/wp-content/uploads
  5. Update /etc/fstab for Persistent Mounting: To ensure the new volume mounts automatically at the correct path after a reboot, update the /etc/fstab file.

    Open the /etc/fstab file:

    sudo nano /etc/fstab

    Add the following line to mount the volume at boot:

    /dev/sda /var/www/html/wp-content/uploads ext4 defaults,nofail 0 2
  6. Set Correct Permissions: Ensure the new uploads directory has the correct permissions so that the web server can read and write to it.

    sudo chown -R www-data:www-data /var/www/html/wp-content/uploads
  7. Verify the Setup:

    • Check that the new uploads directory is accessible and correctly mounted.
    • Visit your WordPress media library and ensure that previously uploaded images load correctly.
    • Try uploading a new media file through the WordPress admin to verify everything works as expected.

For more detailed information, you can refer to the following resources:

Let me know if you have any questions!



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel