User Tools

Site Tools


gcode_storage

This is an old revision of the document!


Sovol KlipperScreen

GCode storage

Sovol's KlipperScreen uses an 8GB emmc card for storage, of which about 7GB are used by the system.

If the empty space gets completely used up by gcode files, it will lead to problems, e.g. the PowerLossResume can cause a boot loop, because it cannot update its state file (saved_variables.cfg).

This can be prevented by using a usb-drive to store the gcode files to.

There is an automount script, which automatically detects inserted usb-drives and mounts them to ~/printer_data/gcodes/USB, but it does not automatically store the gcode files there.

Sadly, it is not an easy task getting the system to just use this “USB” subdirectory, it would require changing several config files (printer.cfg, mainsail.cfg, fluidd.cfg and the moonraker sources).

But it is possible to mount the usb-drive directly to ~/printer_data/gcodes. This way the gcode files will be written to the usb-drive, but to Klipper it looks like the usual directory. So none of Klipper's config files have to be changed, no matter if the drive is inserted or not.

Requirements

  • The usb-drive has to be formatted as linux-ext filesystem (it has to support linux-style access rights), otherwise it will give errors when uploading gcodes.
  • Preparing the partition and formatting ext is not possible on Windows, that has to be done from linux (it can be done from within the KlipperScreen).
  • When inserting/partitioning/formatting the disk, the automounter will mount it to ~/printer_data/gcodes, so we will have to unmount it before each step.
  • When the usb-drive is not inserted, the system should boot up normally (by default it would wait very long at boot and raise an error afterwards). That can be achieved by mount options in the fstab.
  • To do all these steps, you have to log into the device by using ssh/putty.

Beware: If all that sounds very gibberish to you and you are a complete linux novice, then it might be better to just leave the system as-is and just clean up the old gcode files manually.

If you mistakenly format or partition the wrong drive, you can brick your device in a way, that you have to reflash the whole emmc card!

You have been warned!

Instructions

  • Boot up the Klipperscreen.
  • Insert a usb-drive to one of its usb ports.
  • Have a look at mainsails “G-CODE FILES” tab:
    It should show a new subdirectory called “USB” (there can be more, e.g. USB_1, USB_2, etc.).
    • Use the “refresh current directory” button (the round arrow).
      Sometimes this is required 2-3 times before it is really shows the actual content.
    • If no “USB” subdirectory shows up, the drive could have a problem.
      You may consider using a different one right from the start - or just continue and see if it works.
  • Use putty or ssh to log into the device.
  • Become root: sudo su
  • List the block devices: lsblk.
    The output should look like this:
NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda            8:0    1   7.5G  0 disk
└─sda1         8:1    1   7.5G  0 part /home/mks/printer_data/gcodes/USB_1
                                       /home/mks/printer_data/gcodes/USB
mmcblk1      179:0    0   7.3G  0 disk
├─mmcblk1p1  179:1    0   256M  0 part /boot
└─mmcblk1p2  179:2    0   6.9G  0 part /var/log.hdd
                                       /
mmcblk1boot0 179:32   0     4M  1 disk
mmcblk1boot1 179:64   0     4M  1 disk
zram0        251:0    0 455.5M  0 disk [SWAP]
zram1        251:1    0    50M  0 disk /var/log
zram2        251:2    0     0B  0 disk
  • The name of the usb-drive starts with “sd”.
    In this case, it is sda with the partition sda1 (this is the default, if it is the only usb-drive inserted).
    It shows, that it is mounted two times:
    • /home/mks/printer_data/gcodes/USB_1 and
    • /home/mks/printer_data/gcodes/USB
  • In the following steps I will only refer to sda as your usb-drive.
    If it is e.g. sdb, then change it in the next steps.
  • DO NOT TOUCH ANY OF THE “MMCBLK” DEVICES! (The system resides there.)
  • Unmount the drive from *all* locations listed above:
    • umount /home/mks/printer_data/gcodes/USB
    • umount /home/mks/printer_data/gcodes/USB_1
  • Make sure there are really no more mountpoints listed for your usb-drive by running lsblk again.
  • Change the partition type (make sure to use “sda”, not “sda1”):
    • run cfdisk /dev/sda, it should give a screen like this:

  • Press “T” (for “Type”). This takes you to a selection screen:

  • Scroll down and select 83 Linux (by pressing ENTER).

  • Now the cfdisk screen should look like this:

  • Press “W” (for “Write, you may need to press SHIFT as well).
  • Press “Q” to quit cfdisk.
  • We need to unmount that drive again (because the automounter detected the partition change):
  • umount /home/mks/printer_data/gcodes/USB
  • umount /home/mks/printer_data/gcodes/USB_1
  • Reassure that it is not mounted any longer by running lsblk
gcode_storage.1729250141.txt.gz · Last modified: 2024/10/18 13:15 by torte