i've auto added a 100gb volume to my droplet for storage, how do i save and retrieve files from the volume, what path would i use?

apologies for the novice question. I am a beginner at all of this.

I’ve been working on an app using the laravel framework with forge/digitalocean, and came to realize I needed much larger storage. After some research found out that digitalocean volumes seemed well enough to store the massive amount of images, json files, etc… I needed for the app.

My question is normally within the framework I can access any file to save it/retrieve it with either a relative/absolute file path, but I can’t seem to figure what the next step is to save files to the newly mounted digitalocean volume i.e. what path to use to save the file to, and of course what path to use to retrieve the file after saving.

I’ve seen some mention of symlinks being used or possibly mounting the volume directly to a laravel directory or creating a new disk in laravels flysystem. But this all seems counter intuitive, and I don’t think trying to save the file with …/…/…/…/…/mnt/newlyCreatedVolume is the answer.

Any help or guidance is appreciated.

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.

DigitalOcean Employee
DigitalOcean Employee badge
November 25, 2018
Accepted Answer

Hey friend,

Great question! I don’t really use larvel myself but this should be a generic Linux question regardless of that, but just know that this is where I come from when answering it.

Let’s say your Laravel project is in /home/username, and your volume is /dev/sda. I would do this:

mv /home/username /home/username.bak
mkfs.ext4 /dev/sda #(this erases the volume, don't do this if you have data on it right now)
mkdir /home/username
mount /dev/sda /home/username
mv /home/username.bak/* /home/username

And then to top it off, if it’s /home/username because you’re working on the project while under the user “username” and not root, then:

chown -R username. /home/username

Then just keep working on your project in /home/username like nothing happened, run a “df -h” to see that /home/username now has the amount of storage of the block storage volume. To make the mount persist on reboot, do this:

echo "/dev/sda /home/username ext4 defaults 1 2" >> /etc/fstab

Remember that my example has the volume as /dev/sda. You can see the volumes on your droplet by running “fdisk -l” and you can generally tell them apart by their stated size.

Hope this helps :)


Try DigitalOcean for free

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

Sign up

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