We have an E-Commerce website using droplets. And we want to separate the storage of some files, ex. pictures. So we want to know if Spaces can be mounted as a local drive.

  1. How to mount with Spaces?
  2. Can we have multiple servers mount with the same Space?

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
1 answer

Hello, @TsungyingChen

You can mount a DigitalOcean space on your droplet and use it for storage of some of you data. In general, object storage solutions like Spaces are not meant to be accessed like a file system. They are API driven and most often used programmatically. You can check out this tutorial to learn more about object storage and if it’s right for your use case:


I’ve recently posted a question in the community on how to manage DigitalOcean Spaces using s3cmd:


You can use s3cmd in order to mount the Space to your droplet and from there you can transfer files directly to your Spaces. s3cmd also have a feature to sync directories. In this way you can always make sure that you have all of your latest project files uploaded to your bucket:

You can also use other tools like s3fs in order to mount the space. Also you can mount the Space on multiple droplets, there is no issue in doing that.

You need to do few steps:

1 First is to install s3fs:

sudo apt-get update
sudo apt-get install s3fs

2 Once that is done you need to setup your DigitalOcean Space credentials:

echo <space_key>:<space_token> > ~/.passwd-s3fs
chmod 600 ~/.passwd-s3fs

3 You need to sort the user permissions:

By default, DigitalOcean Space is mounted for root user. Because of that, any files or folders that are created via the web control panel is not accessible by non-root users after it’s mounted, which is not ideal.
To make sure that we can access it via a non-root user, we need to update the config file:

sudo nano /etc/fuse.conf

Uncomment the part that says:


Next, find out your user’s details by typing the following command:


You’ll see an output like this:

uid=1000(sammy) gid=1000(sammy) groups=1000(forge)…

In this case, the user is sammy, so you need to note down the uid and gid of the user for the next step.

4 Mount DigitalOcean Space

First, make a mounting folder:

mkdir <folder>

e.g replace the <folder> with the actual folder you would like to use, the command will be: mkdir space-storage

Then, let’s mount the Space to our new folder:

s3fs <space_name> <folder> -o url=https://sgp1.digitaloceanspaces.com -o use_cache=/tmp -o allow_other -o use_path_request_style -o uid=1000 -o gid=1000

Note: replace the space_name , folder and the uid , gid and URL with your actual space name, created folder and the user IDs received from the id command in step 3 and the URL of your space, e.g it can be sf03.digitaloceanspaces.com and not sgp1.digitaloceanspaces.com

If you want to unmount the space you need to execute this command:

fusermount -u <folder>

That’s all for using s3fs with DigitalOcean’s Spaces.

Hope this helps!


by Brian Boucheron
Flexible and scalable data storage is a baseline requirement for most applications and services being developed today. With today's complex deployments, containers, and ephemeral infrastructure, the days of simply saving files to disk on a single server are gone. Cloud providers have developed services to fill the storage needs of modern application deployments, and they mostly fit into two categories: object storage, and block storage.
  • Hi

    Will this delete the contents of the droplet?

    • Hello, @adsaro

      If you unmount - umount the space from the droplet you will not delete the actual content of the space.

      Also mounting a space on your droplet this will not delete files/data on the droplet itself.


  • Hello Alex,
    wrt to “2 Once that is done you need to setup your DigitalOcean Space credentials:echo <space_key>:<space_token> > ~/.passwd-s3fs” comment, does the <space_key> correspond to “DO spaces secretkey” and <space_token> to “DO spaces accessid”?
    Please help.

    • Hello,

      Yes that is correct. You need to change the spacekey and the spacetoken with the actual details which you can acquire from the Spaces access keys menu in your account.


  • Hello.

    I’ve tried this but it’s not working. s3fs is returning a 404 bucket not found error.

    Please help asap

    • Hello, @andrewsatakangah

      Can you please double-check that the name of the bucket is correct? You can also share the configuration here as well.


      • Thanks for your reply @alexdo .

        I have managed to get it working now. I had to replace the url parameter


        in the s3fs mount command with that of my space’s url instead. Seems the url in the command has the space provisioned in singapore wheras mine was provisioned in san francisco i.e sf03.digitaloceanspaces.com

        So, it leaves me wondering whether this answer needs updating to specify that the space’s url be used when executing the mount command, or I had made a mistake in following the steps.

        • I’m glad that you’ve sorted this.

          You’ll need to enter the URL of your space, that is correct. In your case that is sf03.digitaloceanspaces.com and not sgp1.digitaloceanspaces.com

          I will update this right away.

          Hope that this helps!

  • Exactly followed your steps! Worked perfectly. Just want to know, how can I access all files and folders of space from the droplet local directory? e.g., want to cd into [root space folder]/[child folder] from the droplet.

    I tried simple cd command gives me an error No such file or directory, though there are directories!

    • Hello there,

      I had a similar issue in the past where the mount point was created via the root username and I’ve tried to then access it using a different user who didn’t have access to the directory itself.

      Can you verify that the mount point directory is accessible for your system user?