Need help understanding why won't my disk work


So the way i understand it, disks are supposed to save data and files on your project so as they don’t get deleted between deploys. on my website i enable the users to upload images of their profiles and products. so i naturally added a disk to preserve these uploaded images.
my projects root directory is something similar to “./rootdir” and i save the uploaded images to “./rootdir/uploads”. so i set the directory of the disk once to be “./rootdir/uploads” and the other try i set it to just “/uploads” and in the both cases when i redeploy my website i lose all uploaded images. why isn’t my disk working? i’m checking on the disk usage and it’s not changing either (just 0.03MB) so basically the uploads aren’t getting there. what am i doing wrong?


Hey Mo,

If /uploads is the mount path then you need to make sure that your upload directory is set to that in whatever framework/language that you are using for your service here. A handy hint here is to use the shell tab to check the contents of the path when you’ve performed an upload as it should be written to that path and if it’s set wrong it would be written into the uploads path in your root dir,


John B

Hey John,
Thanks for your reply.
it seems i’m failing to understand how the path of the disk works as it just doesn’t work no matter what what path i assign to it. i even went as far as to assign something like this: “/project/src/root path/uploads” and still nothing works.
i tried using the shell tab and i’m able to see that the files are getting uploaded to the correct directory by the server. but they aren’t being included in the disk. i don’t understand why.

should the disk path and the path of my uploads be different or something?

Let me assure you that files written to the disk path will be being written to the disk - that’s where it’s mounted. It feels like there’s something else at play here.

Please configure uploads to go to the mount path - please then share the place in your code where that config is and we can take a look,


John B

do i need to configure anything in my code to be bound or linked to the disk in anyway? my backend code handles uploads by storing the uploaded files/images in the assigned directories inside uploads. basically uploaded profile photos will be stored in /uploads/profile_photos. product photos will be stored in /uploads/product_photos. and so on. i can tell it works fine because images are loaded and displayed correctly on the front end (until i redeploy which causes them to be wiped out)

You just need to make sure that you’re using the mount path for your disk as the path to store your uploads. If you’re losing uploads on deployment then the uploads are being stored in the wrong path.

One thing to double check is that you’re using the absolute path, sometimes the files end up relative to the repo which is incorrect.


John B

i need to confirm this, is a directory for the disk generated at the mount path?
basically i set the path to be “./project/diskName”…is a directory with the name of diskName created at that path? if that’s supposed to happen then it’s not happening for me as i’m checking through my project directories in the shell and not finding anything at all related to the disk i created. how can i be sure i’m entering mount path correctly to be exactly what i need?

When you mount the disk you specify the mount path where the disk should be mounted. It’s an absolute path so if you mount it at /data then it’s /data - it’s not relative to the project repo, it’s an absolute path.

John B

i see. but my uploaded files are stored in the uploads directory within the repo files. how can i make sure that the absolute path is configured correctly to mount there?

actually if there was any article/video that clarifies this with an example it would help me solve this issue. the official docs article doesn’t have that

I am having the same concern.
I have an admin page that is supposed to upload files.

I haven’t tried it yet, but tomorrow I will try adding a disk file

Based on what Iv been reading. Once you make the disk you have to configure your code to upload it to the disk. Not the files on your repo. for example:

// node fs 
   callBak(null, pathToDisk) //server

Of course, don’t name the disk on render the same as the ‘uploads’ dir that you have on your repo. (yes I know you can just gitignore it but I am sure you need the dir for local development.)
Now if you want to transfer your current dir from your repo. You will have to SSH to the disk. Not sure why render doesn’t just have a fold upload option. But that’s how I am planning on doing it tomorrow.
Good luck.

So ya dont use render disk it’s dumb
this is how I need to access my media disk folder that I put in


that is plain stupid in my opinion. From your project root, you need to go up this filesystem
/opt/render/project/src cd all the way out cd ..
the shell is broken(or maybe it’s normal, I don’t have a degree in filesystems…or anything for that matter) So you will not know when you hit opt or render
Then after that, you hit this:
bin boot dev etc hello home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var

all of those dirs are the only thing on the file system that persists when you push changes.
media is the previous disk(deleted) and hello is the current disk, (doing some more testing)

I thought they were going to insert and remove the disk on my project structure when a new commit comes in. But I suppose that is very risky and might take some time with large files. I did try to remove media folder from shell. It said it was read-only. However, I will try to delete ‘content’ from the media and see if that’s possible. If it is. Then I should be able to use render to host my images. I am not sure if I want to though. I think it’s safer and better with a third party. I will be using:

Thanks for your experience and opinion. i hit a dead end with this as well. guess i’ll try firebase storage or something similar to store my files

No problem. Goodluck!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.