How can i connect Wordpress media library to one or multiple Block Storage(Volumes)?

Posted July 13, 2016 7.6k views

The Block storage feature is awesome, i was one of the beta testers. I’m using Wordpress and i want to connect Media library or Uploads folder to one or multiple block storages i have created. I could do this buy linking folders in Ubuntu, but this just works for one volume. Is there any other way to do this that i don’t know?

Thank you in advance

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.

Submit an Answer
2 answers

I’m not sure how you would be able to point the uploads folder at multiple volumes at once short of doing something like setting up a RAID array. I’m curious what you use case is?

If you want to move the location of the WordPress Media library and Uploads folder without using sysmlinks, you can define the location in your wp-config.php file. You can not use absolute paths though. So if the folder is located at /mnt/volume-nyc1-01/wp-uploads, you would set:

define('UPLOADS', '../../../../mnt/volume-nyc1-01/wp-uploads');

Some other points to consider are that you need to ensure the folder is owned by the webserver user. On Ubuntu, this would be www-data To do so, run:

  • sudo chown www-data:www-data /mnt/volume-nyc1-01/wp-uploads
  • Thank you very much for the other option you mentioned.
    I was just thinking for the future plans. Like separating Video volume from Zip files volume (or other formats) for better categorizing and also not to make a volume full in just a year or less (because of the maximum 16T limit).
    I think the symlink is a more reasonable way for linking one volume for now until someone create a good plugin for this purpose.

    Thank you

  • I was trying to relocate my uploads file to a volume using this suggestion

    but when I uploaded an image into the media library it tried to make the image URL which of course was broken

    Does wordpress allow you to move up directories like this?

    • You needed to specify the whole path to the volume directory. To fix run the commands below

      cd /path/to/wp-content/
      rm uploads
      ln -s /mnt/volume-nyc1-01/wp-uploads/ uploads

      First command changes you to the site wp-content directory.
      Second command is used to remove the uploads symlink, if you don’t have a symlink created then skip it. Do not run the command with -r.
      Third command creates the symlink, it should work now.

    • Hi, did you able to access the media file from browser after you uploaded to media, let me I also go stuck, i have succesfully uploaded the image file but I am not sure how to call it show in website.

      I upload to volume
      and image file there is uJiSVyX3_vWqOi2kYjLNsMuI0Y4l3M.jpg

      so how do i call it to show in website, can you able to help

Hey everyone,

Just want to add for other folks that may help, if your using this article which is awesome so kudos guys, and your WordPress install whether one click or LAMP stack, your uploads folder will not exist until you upload a file to it or create it.

Hope that helps, Thanks for info above again!