How to move Octoprint and assoc. to larger mem. Card?

Good Afternoon to you all.

Can anyone help?

Is there a way to transfer all the Octoprint and associated data from the original Memory Card and copy it to a larger Memory Card?
I'm using an 8gb Card at the moment but have recently noticed that the available memory has dropped dramatically to 824mb which previously was at around 6.8GB out of 7.0gb.
I have deleted the error logs but it didn't seem to do anything and also I have only 2 printable files loaded which total 11.1mb? and have not installed anymore plugins etc.

Any help would be most appreciated

1 Like

There's two approaches to achieve this. You could just install octopi fresh on a new card and use OctoPrint's Backup and Restore feature. Or you could use etcher or win32diskImager to clone your existing card to img, and then flash that to a new card. Once you boot up on the new card you use raspi-config to extend the partition.If you're on linux/mac I think the command to use for creating and flahing images is dd.

3 Likes

Make sure you don't have loads of timelapses either. Can fill up the space if they're never deleted.

1 Like

Are you taking pictures or timelapse during prints - these eat up a lot of disk space. You'll need another Linux machine to clone the images, as @jneilliii mentioned, the command to use is dd, but first, after putting the sd card into another machine you'll need to dismount the partitions, if they automount, because dd works at the device level, not the partition. A Pi sd card has two partitions, which you'll see if the partitions automount in a Linux desktop machine, /boot and /rootfs. /boot only has enough space to boot the microcode for the chipset, then the operating system boots off /rootfs - its the /rootfs where octoprint and its datafiles are stored. So you only need to clone /rootfs. I'll dig out some more instructions, which are on a USB drive and post another answer.

Many thanks to you all.
I don’t have any time lapse either so I don’t know what’s using the space?

you could log in via ssh and use ncdu to check what is using the space

Sorry if I'm highjacking this thread but my query is pretty similar. Before updating to 1.4.2 I wanted to clone the Octopi microSD card as a backup. The cloning software I used seem to do it's thing fine but having finished it popped a box saying that if the card had a Linux system on it , I should reinit Linux. Not being Linux savvy I have no idea how to do that. The cloned card does not boot.

Alternately, some way to clone an SD card that doesn't need a "reinit".

Hi, I’ve tried the ncdu command which showed the following:-

Doesn’t seem to add up?

try ncdu /
so you see everything from root, nit just /home/pi

Thanks for the advice mmcp42, I now see the other used memory as follows, can any of these be removed?

open the /var/log directory so we know which log is that big

Hi here’s a shot of the var/log folder

image

for those cases I use this script

download it with wget https://github.com/Lin-Buo-Ren/Coward-Unix-Log-Cleaner/raw/master/Coward%20Unix%20Log%20Cleaner.bash
and run it with sudo bash Coward\ Unix\ Log\ Cleaner.bash

it does the job for me :slight_smile:

Many thanks PrintedWeezl for your help!

1 Like

Logs looks like a good one. Delete the older logs. Should free up some space
Cheers

I promised the dd commands although we can see that /var/log had a lot in from the screenshots.
If you have mounted the card using a USB sd card reader the first thing we need to find are the devices:
type 'df' and you'll get a report of the disk file system usage.
You are looking for something like /dev/sdb1 in the first column and /media/username/boot in the last column - that's the boot partition - and there'll be another /dev/sdb2 with /media/username/rootfs - that's the root partition. N.B. username is whatever you are logged in as, if you are using a Pi it will be /media/pi/boot.
If you've mounted them in an mmc slot in a laptop as I have just done, the devices are /dev/mmcblk0p1 for the boot and /dev/mmcblk0p2 for the rootfs. Its outside this post to explain the difference as its deep into Linux devices and naming, but if you eject the card, the devices disappear.
So lets work with /dev/sdb1 and /dev/sdb2 as examples.
To unmount the partitions without ejecting the card type 'sudo umount /dev/sdb1' then 'sudo umount /dev/sdb2' . This means the device 'file' is still there and its this that you use in the dd command.

Assuming the machine you are using has plenty of disk space you can just create images of each sd card partition doing this:
sudo dd if=/dev/sdb1 of=~/boot.img
and
sudo dd if=/dev/sdb2 of=~/rootfs.img
'if' means input file and 'of' means output file
The boot image copy won't take very long
The rootfs copy will take much longer because the partition is 8GB - or 16GB, or however big the partition is.
Those .img files are now on your home directory, that's what ~/ means along with the filename.
If you create a new bigger sd card with octopi on, you can then copy those image files back.
Put the new card in, unmount the partitions and then use
'sudo dd if=~/boot.img of=/dev/sdb1'
'sudo dd if=~/rootfs.img of=/dev/sdb2'

BE VERY CAREFUL that you know which devices your old memory card mounts on - you don't want to overwrite the system you are running. Once you've copied your image files back over to the new card, eject and put into your Pi and boot - n.b. this won't work if your original images don't have the correct boot files for the Pi you are using, so beware if you are using a card that was created before the Pi4 was released.
BTW, the image files on your hard disk are essentially backups, very useful, I've just had a Pi trash its microSD card and I've had to rebuild Octoprint on a new one.

1 Like

Many Thanks rcw88,
This information will be most helpful

Thanks

I thought I'd throw this out there (as someone who owns way too many microSD cards)...

I have macOS and use Apple-PiBaker. It makes it easy then to clone a card. Boot the new one and expand the filesystem using sudo raspi-config and you're all set.

1 Like

I use Macs too, but not with the 3D printing, am using discarded (i.e far too old to run Windoze on) laptops with Ubuntu LTS 20.04 or Pixel X86, I'm a STEM Ambassador, so have a fleet of scrapped laptops to hand that I use with STEM events.

I also am using a Mac and I will have a look at the Apple-PiBaker program. Many thanks

1 Like