Hi,
How Do I Change File Upload Directory From Droplet File System To Volume Block Storage?
I have a Droplet running Ubuntu 18.04 with Apache. I have a project wherein I need to upload lots of videos and hence I added a Volume of 100GB to my Droplet.
Default project video upload path is /var/www/html/public/uploads/videos and i want to change this location to /mnt/volume_blr1_01/uploads/videos
I have tried Symlink with the below command but symlink doesn’t seems to change location of video upload sudo ln -s /mnt/volume_blr1_01/uploads/videos /var/www/html/public/uploads/videos
I also tried adding alias in conf file and failed.
Also, the videos that i upload in block storage /mnt/volume_blr1_01/uploads/videos needs to be secured where only my project can access it and no direct requests
Can anyone please help how can I achieve this or what would I have to do?
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!
Hey friend,
For the purpose of my answer, I’m going to assume the block storage device is /dev/sda. In that case I would do this:
# Unmount the current mount
umount /dev/sda
# Move the existing content aside for a moment
mv /var/www/html/public/uploads/videos /var/www/html/public/uploads/videos2
# Make a new, empty directory where the content needs to be
mkdir /var/www/html/public/uploads/videos
# Mount the drive to that new, empty folder
mount /dev/sda /var/www/html/public/uploads/videos
# Move the files from that temporary directory back into the right place
# which is now mounted as the directory in question
mv /var/www/html/public/uploads/videos2/* /var/www/html/public/uploads/videos
Then edit /etc/fstab to indicate the new mount location being /var/www/html/public/uploads/videos instead of the existing area in /mnt.
Jarland
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.