How to access files on the printer's SD card

When an external drive is connected to a USB port, it appears as a folder in /media/pi/
Does the SD card appear somewhere in Linux file structure as a mounted drive?

No, it doesn't. The SD card is connected to the printer, the printer is not a card-reader.

It depends on what firmware and control board you have. For instance running Marlin on a 32 bit LPC176x based board, or Smoothieware on a similar board can make the SD card available as a USB drive. However it may not be visible directly. Under Marlin if the card is in use by the firmware (which it probably will be) then it is not available directly via USB as a drive (but you can issue an M22 to unmount the card from Marlin which will then make it available as a USB drive, you may then need to mount the drive under Linux (there are ways to automate this). If you are running smoothieware then this https://github.com/foosel/OctoPrint/wiki/Setup-OctoPrint-with-Smoothie covers it much better than I probably can.

1 Like

You are asking about an SD card in your printer, and not the one from which you booted your Pi, right?

Yes, the card in the printer. Am trying to understand the way things work (limitations) so I can form a file management strategy.

An M20 gcode command lists the files on the SD card that's inserted into the printer's controller (assuming that your firmware supports that). If OctoPrint's default settings are in place then it will attempt to do that upon connecting to your printer so that those files would be displayed in the side panel Files widget.

In theory, one might be able to purchase an expensive SD card with wifi built in. And then, house elves could magic up some means of connecting to the wifi hotspot and then do an accio lima command. Or maybe read this entire thread.

@gtaylor828 it would probably help if you told us what control board and firmware you are planning to use as the answer to your question may be different depending upon the configuration.

Don't use an EyeFi card...pretty much ever, but especially not with a printer...use a Toshiba FlashAir card instead, as they are fairly easy to make work and are supported products with updates fairly regularly:

(Bumping this thread in case someone winds up at this thread via a search and needs better info, since I found it while searching for something else)

1 Like

How is it possible this drive isn't mounted if you can use octoprint web interface to upload files? How is octoprint viewing & uploading files then? Should be somehow possible with command line then as well. I'm just wondering since I could upload firmware to SKR 1.3 with SSH and just restart printer to apply it..

Hi @Zalama!

OctoPrint runs on its own. The drive is only mounted to the system on the Pi, not to elsewhere. Uploads are managed by OctoPrint.
It's like any other service in the internet: You get data for the screen (browser), you can upload and/or download files, but you do not have access to the drives of the service.

You can gain access to the files per keyboard/monitor attached to the Pi, via SSH and/or FTP. But that folders are not meant for general purpose. It's a closed system, not a file server.

Yes? That is what I'm especially talking about. Since it is mounted to system / server (RPi) it must be accessible through SSH as well somehow.

Octoprint is a service that runs in RPi so it must have that SD card mounted in system somehow. It just isn't mounted to any "standard" place.

I want to upload firmware files to that SD card. Otherwise I need to turn off printer and save it manually to SD card. SKR 1.3 will read always firmware.bin file from SD card if it is there and apply that new firmware automatically.

For the Firmware Updater?

OctoPrint uses specific gcode commands for managing files on the printer's sd card. There's no mounting going on, it can only write, not read, and everything has to be transported through the text only serial interface of the printer so binary firmware files won't work either.

I see, he meant the printer's SD card...

(Silly me, thread title :man_facepalming:)

So it has some serial interface for sending files. Maybe I need to find out some drivers to allow mounting that SD card then. Windows has them as standard so when you plug in SKR 1.3 through USB you can see your SD card as a removable drive (like usb or sd card connected directly).

And Firmware Updater isn't going to help as SKR 1.3 isn't Atmel based board but has 32bit LPC1768 chip.

I will note that the Buster Desktop version of Raspian—when you connect a Smoothieboard to that Raspberry—sees an icon on its desktop. I assume this is the SD card on the Smoothieboard.

Maybe this isn't anymore about octoprint but maybe if there is some linux guru out there. I can see that device with lsusb but not with fdisk so I'm not able to mount it. It seems when attaching device it will try to attach it but it fails so for some reason..

Oh ffs...

Solution was more simple. That SD card was faulty some way. I changed to old 128Mb spare SD card and I was able to mount it with not problem. I have been banging my head for hours for this..
image

1 Like

So I take it that you physically removed the bigger SD card from the printer's controller and then inserted it somehow into the Raspberry Pi?

Not sure what format the standard printer controller uses these days. That one looks like an old FAT version from the days of Windows (which would explain why the file listing in OctoPrint has the mangled 8.3 short filenames).

I was struggling with this problem for a few hours today and finally found the only the SD mounts is if I power cycle the printer after the pi boots. This works for me, it's only for flashing firmware. Follow firmware updater instructions for installing usbmount. Make sure you have OctoPi Stretch because the directions don't work on Jessie.

For those who misunderstood the situation. The SKR 1.3 board with 32bit LPC1786 CPU has an on board SD card for flashing firmware. This is not the LCD SD card and you can't flash with Arduino. The updated OctoPrint Firmware Updater has support for this which is basically copy the firmware file to the onboard SD card and reboot. In my case this feature is necessary because the board is in the Tevo case and SD is not easily accessible.

After pi reboot.

kernel: [ 2805.601482] cdc_acm 1-1.4:1.0: ttyACM0: USB ACM device
kernel: [ 2805.602902] usb-storage 1-1.4:1.2: USB Mass Storage device detected
kernel: [ 2805.615064] scsi host0: usb-storage 1-1.4:1.2
mtp-probe: checking bus 1, device 6: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4"
mtp-probe: bus: 1, device: 6 was not an MTP device
kernel: [ 2806.649267] scsi 0:0:0:0: Direct-Access Marlin Re-ARM SDCard 01 1.0 PQ: 0 ANSI: 0 CCS
kernel: [ 2806.650309] sd 0:0:0:0: Attached scsi generic sg0 type 0
kernel: [ 2806.656957] sd 0:0:0:0: [sda] Attached SCSI removable disk
kernel: [ 5448.625687] usb 1-1.4: USB disconnect, device number 6

After printer reboot.

kernel: [ 328.344721] cdc_acm 1-1.4:1.0: ttyACM0: USB ACM device
kernel: [ 328.345711] usb-storage 1-1.4:1.2: USB Mass Storage device detected
kernel: [ 328.346647] scsi host0: usb-storage 1-1.4:1.2
mtp-probe: checking bus 1, device 7: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4"
mtp-probe: bus: 1, device: 7 was not an MTP device
kernel: [ 329.351905] scsi 0:0:0:0: Direct-Access Marlin Re-ARM SDCard 01 1.0 PQ: 0 ANSI: 0 CCS
kernel: [ 329.352934] sd 0:0:0:0: Attached scsi generic sg0 type 0
kernel: [ 329.353392] sd 0:0:0:0: [sda] 3932160 512-byte logical blocks: (2.01 GB/1.88 GiB)
kernel: [ 329.355486] sd 0:0:0:0: [sda] Write Protect is off
kernel: [ 335.891821] sda: sda1
kernel: [ 335.902072] sd 0:0:0:0: [sda] Attached SCSI removable disk

1 Like