How to change the upload folder to a mounted drive

What is the problem?

I'm trying to change the upload folder to use a mounted USB stick.

What did you already try to solve it?

I've mounted the USB via the fstab file and it maps correctly in SSH at the server. At the pi@octopi cursor the path is /media/files

Putting the path for Upload Folder as /home/pi/media/files shows as valid but doesn't show the files that already exist on the drive.

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, octoprint.log, serial.log or output on terminal tab, ...)

Raspbian is current version. Octoprint is current version.

The path (on a Raspberry Pi) for the uploads folder is ~/.octoprint/uploads, for what it's worth.

  1. stop octoprint
  2. rename the ~/.octoprint/uploads folder to ~/.octoprint/
  3. create a symlink that points the /media/files to show up as /home/pi/.octoprint/uploads
  4. change the owner of the /media/files folder
  5. start octoprint again

To change the owner of the /media/files folder to be pi, as in:

sudo chown pi:pi /media/files

In theory, this should work.

It's not working. OctoPrint won't start with a critical error that the ~/.octoprint/uploads folder doesn't appear to be writable.

I've created the symbolic link and the permissions are lrxxrwxrwx. The directory itself on the USB drive has permissions of drw-rw-rw-

The ownership of the drive and the symbolic link are pi pi

It seems odd I should just be able to change the directory location in the folders section of the settings.

I don't think drw-rw-rw will do the job. You probably need x (directory search) permissions, too. Try changing the mode to 775 0r 755 (don't know if group write permissions are necessary).

1 Like

Did you ever get this working? I am trying to achieve the same thing only I am mounting a network drive.

You could use the approach that I did before and mount a subfolder under the ~/.octoprint/uploads folder.

I did! I really did! And I'm writing up a full tutorial with pictures for the near future but the key was making the mount point in the .octoprint directory I believe.

  1. Create the mount point. I made a ~/.octoprint/USB mount point so I could add folders later
  2. Change the permissions to 777 recursive
  3. Change the owner/user to pi recursive
  4. Create the folders
  5. Update the /etc/fstab file with the mount information
  6. Update the /boot/cmdline.txt to include rootdelay=5 (let the Pi finish loading before mounting)
  7. Update the folders in OctoPrint
  8. Move the files from their current location to the new one (if necessary)
  9. Reboot the Pi

Well done.

Just make sure that you don't physically remove the USB thumbdrive while OctoPrint is running (especially while it's printing).

That's kind of a given but the warning will be in the tutorial.

I need to experiment a bit with putting files directly on the drive and how the timelapse functions when writing to the USB. And pulling the timelapse directly off the thumb drive. But in general I think I've got it.

Speaking of timelapses and when to eject... there's kind of an odd thing for the timelapse feature. If you want, say, a 60-second ending of the last frame, don't enter 60 in that dialog box. At the most, just say "1". It will do some sort of conversion into "timelapse seconds". One time I did that and it tool like 24 minutes to finally finish the timelapse at the end.

Hi, did you ever make that guide, it would really help me out!

I did. Of course it would HELP if I linked it or something, right?

Mount a Drive

Hi man! thanks for the guide. I follow all the steps but it doesn't work. I took some pictures to show you. I store two .code files on my mounted usb but still not working. Can you help me? thanks a lot!

Yep, I have done the same a while back, all my print folders reside on a local NAS, along with all the time-lapse folder & co. So that the Raspi does not have to bear the file load. If you have connected a local drive via USB you will most likely not have latency issues, in my NAS case I had to switch from using WIFI to ethernet to make it more reliable and stable.