EmonPi backup failed - Out of space

I tried to do a data backup from my emonPi today, but it failed saying there was no space left:


Which is fair enough since it is a 16GB card with several years of accumulated data on it.

Memory stats:

The last backup I did was back in Aug '19 and the compressed file was 60MB is size.

I have a new 64GB card to replace the old one, but is there a way to copy the old SD card onto the new one
so I can then safely backup my data.
I’m also probably a couple of years behind the latest EmonSD version, so I guess I should also upgrade to the latest.

Can anyone give me some pointers, or a link to a guide?


@TrystanLea posted this a little while back.Backup module usb-import.sh script (beta)

You can use

sudo du -a / | sort -n -r | head -n 20

to find the largest files (probably logs) - it takes a few minutes.

To make the files smaller (deleting them can be a bad idea) use

truncate -s 0 /<path to file>

[edit] as long as the big files listed are not the data files!!!

Thanks Brian,

After trying that first command, I see the problem. There are several old backup files left there.


I assumed it would delete them each time I run a new backup.

I assume I can just delete them.

would these be the correct commands? (sorry my linux skill are minimal) :blush:

    sudo mount -rw -o remount /

followed by

rm ./data/emoncms-backup-2019-12-14.tar

and so on for each .tar or .tar.gz file?

you should be able to just go into the data folder from there cd data and then rm the files.

[edit] you need to set the file system rw. Can’t remember how I’ll check.

rm emoncms-backup*

Just a point, you didn’t use the command correctly - you have a missing /. It only searched your home folder but this did solve the problem :grin:.

Oh yeah, oops. :blush:

Just out of interest, what does that command I quoted before do?
sudo mount -rw -o remount /
I found it in my notes saying it put it into write mode. :thinking:

Deleted the files and I now have 600MB free.
It’s running a backup now…

1 Like

I’d guess it puts the root partition into RW mode much like the rpi-rw command does.

Thanks for all your help.

The backup has now completed successfully. :white_check_mark:

I was just reading up on how to install the latest EmonSD onto my 64GB card, but is says it can’t be expanded above 16GB, so I guess I’ll leave it.

I just tried that original command (correctly):


Does that imply any further space saving could be had?

Yes, anything significant would show up.

It is on my todo list to fix the partition rezise. However, I think that @TrystanLea has set the script so it fixes the rootfs and the data partition is expanded to fill the rest of the card. It does mean the rootfs is a little small if you want to do other things but OK if just for EmonCMS.

Almost. :wink: :grin:

It puts the root filesystem in r/w mode.

The command remount is something of a misnomer. Viz.:

Remounting a filesystem means changing the options that control operations on the filesystem while it is mounted. It does not mean unmounting and mounting again.
Ref: The GNU C Library: Mount-Unmount-Remount

A root partition is a type of partition within the Windows Hyper-V virtualization environment that is responsible for running the hypervisor. The root partition enables the execution of primary hypervisor software and manages the machine level operations of the hypervisor and created virtual machines.

thumbsup highfive

rpi-rw is just an emon shell script that calls mount.

FWIW it’s not on my system. I guess it was only on systems that mounted / -ro

I doubt you cloned the emonpi repository for your installation. Despite it’s name, it does hold some general stuff as well.

My installation was exactly what was shipped from the shop.

Ah sorry, I was thinking it was a self install. The script will be there (in the emonpi repository clone) but not linked so not directly available from the command line now.

Hi Cliff

Did you run the emonSDexpand command on your system? For a 16GB card your /home/pi/data partition is very small, less than 1GB. You should be able to get 10GB.

Happy 2020!