How to change the upload folder to a mounted drive


#1

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.


#2

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/uploads.save
  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.


#3

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.


#4

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).


#5

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


#6

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


#7

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

#8

Well done.

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


#9

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.


#10

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.