move folder storage

Hi all! I'm trying to change the storage folder in Octopi, the idea is to change it to a flash drive. Will someone have a detailed tutorial? I'm a newbie in this.
Thank you very much to everyone from now!

Assuming that this is on a Raspberry Pi 3B and you're plugging in a USB thumbdrive that you'll leave in most of the time...

  • Remote into the Raspberry with ssh pi@octopi.local using "raspberry" as the default password
  • Run sudo apt-get install -y usbmount
  • Run sudo nano /lib/systemd/system/systemd-udevd.service

Change this line to:

MountFlags=shared

Updated: it was slave before.

  • Run sudo reboot, wait a bit and then remote back into it
  • Insert the USB drive
  • Run sudo ln -s /media/usb /home/pi/.octoprint/uploads/usb
  • Go into OctoPrint -> Files side panel widget and look for a new usb folder, noting that OctoPrint may take a while upon bootup to analyze all the gcode files on it

If you think that you'd like to remove the USB drive, you should copy the file(s) from the usb folder to the main folder in that Files side panel first. It's probably best to only remove the USB drive when the Raspi is off.

Hello Guru! Thanks for the reply. I did just what the tutorial says and when it's time to press the test button, it gives me the message:
The path is not writable.

Fair enough. During analysis, OctoPrint wants to create a file called .metadata.json in each of the folders it finds. It therefore needs write access to every folder it finds on your USB drive.

If you're okay with that, then it should be necessary to consider how one may do this. In my particular case, I see this:

ls -l /media/usb

total 13056
-rwxr-xr-x 1 root root  2203899 Mar  6 00:27 BottleCap.gcode
-rwxr-xr-x 1 root root   143641 Mar  6 00:28 microSD-clip.gcode
-rwxr-xr-x 1 root root 11003591 Mar  6 00:28 PauseButton.gcode

ls -l /media
total 36
lrwxrwxrwx 1 root root    4 Mar  6 08:37 usb -> usb0
drwxr-xr-x 5 root root 8192 Dec 31  1969 usb0
drwxr-xr-x 2 root root 4096 Mar  6 08:37 usb1
drwxr-xr-x 2 root root 4096 Mar  6 08:37 usb2
drwxr-xr-x 2 root root 4096 Mar  6 08:37 usb3
drwxr-xr-x 2 root root 4096 Mar  6 08:37 usb4
drwxr-xr-x 2 root root 4096 Mar  6 08:37 usb5
drwxr-xr-x 2 root root 4096 Mar  6 08:37 usb6
drwxr-xr-x 2 root root 4096 Mar  6 08:37 usb7

In other words, this has been mounted by default as the root user.

Back on that earlier step, change it to:

MountFlags=shared

Reboot and see if that is happier. If it isn't—the likeliest case—then you'll need one more command:

sudo chown -R pi:pi /media/usb0

This would recursively change the ownership of the underlying /media/usb0 mount point to the pi user as well as all files and subfolders. The net effect would be that this should allow OctoPrint to create hidden metadata files within that structure.

Others might suggest that /media/usb would be the location but I'm reasonably certain that Raspbian ignores rights on symlinks.