Replace pre-built SD card with new, larger one?

I have a quite new Emonpi (purchased in 2019), which came with a 16GB SD card. I have just now started using it, and I currently have 60 feeds (10s mostly, a few 1min). I know, it is a lot, but I have CTs on all 23 fuses, and some of them are three-phase, main fuse, heat pump etc. The emonpi is hosting a local emoncms database.

Currently I have used 1.35% (139.2MB) out of the 10.32GB space allocated for data. I do not have enough data to calculate when this will fill up, as the number of feeds have been increasing for a while. But anyway, I still want to check if there is any simple way to replace the SD card with a 32/64/128GB one?

I have only really basic knowledge of RPI, Linux etc,

You can see from the admin page how full the data partition is and so how quickly it is filling up. To move to a larger card it is simply a case of using the backup module to export the data and then import it onto a new instance if necessary.

I would advise to take backups at a reasonably regular interval if you care about the data.

I will monitor the fill rate, of course.
I saw the backup module, it is great, and seems very easy to use. But is it so that the operating system and all software is installed on the same sd card? My question then would be

  1. Is it easy to configure a new sd card with emoncms, OS and everything, or alternatively,
  2. Keep the existing sd card, but store data on an external usb storage, e.g. a small, low-cost SSD?

The backup module takes everything from the emoncms system such that, on a fresh install of Emoncms or a fresh EmonSD image, the Emoncms system can be restored with historical data.

It does not backup any other OS or system information.

Brian - will this approach create a data partition larger than 10 GB on SD cards that are larger than 16 GB? From previous posts (i.e., emonSD-17Oct19 Image partition sizes - #5 by borpin), I thought the emonSD images are designed for 16 GB SD cards and won’t create larger data partitions on larger SD cards.

Right now I’m not sure how Trystan has left it. I think he has fixed the rootfs and so the data partition is the rest of the card.

Thanks, I think I will try with a larger SD card and see what happens. Now, I bought the Emonpi pre-installed. The installation is similar to, but not identical to my other RPI wher I installed emoncms myself. The emonpi is on emoncms 10.1.13, while my other installation is at 9.x.x. That could explain some of the difference, maybe? But the emponpi istall seems to have a bit more funcitonality, like the update functions under Administration, and some of the left side menu entries. Will I get an identical emoncms install by doing the config myself?

Ok, so quick google gave the answer, the " Download image & flash to SD card:" option seems to be the right one for me.

1 Like

thumbsup thumbsup

Ok, so finally I replaced the microSD, installed emonSD-17Oct19 (Stable) (it was 30oct18 before). Everything is up and running, so now I will wait and see if the crash continues in one week’s time.

I just installed a 32 GB card, and a faster one, so the emonpi seems to respond much quicker now. But it is also on ethernet cable rather than wifi, so that could also count for something.

The total size of the /var/opt/emoncms folder is stil 9.98GB, so it did not scale and fill the empty space on the larger card. Is there some way to do this?

The new card is definitely making the emonpi faster, particularly noticable when using the graph.

This is what the admin page says after replacing the 16 with a 32GB card:

/var/opt/emoncms: Used: 1.21%
	Total :	 9.98 GB
	Used :	 123.27 MB
	Free :	 9.35 GB
	Write Load :	 1.87 KB/s (22 hours 11 mins)

Is there anyone here that could help me add the unused 16GB of space? I am barely a script kiddy on RPI/linux, so I would need quite detailed aid…

bump
At the current write rate the SD card partition will be at 100% within 15-16 years, so there is no immediate rush here. But still I would - if not for any other reason - learn how to utilize the full 32GB size of the card. Anyone to help me here?

I put the SD card in my laptop to flash the image (with Balena Etcher), then used GParted to expand the 3rd partition to use the entire space available. Very quick and simple with the GUI, no command line knowledge necessary.

But you must make sure you are changing the SD card, not the laptop. The SD card is probably called mmcblk0, and the 3rd partition will then be mmcblk0p3

On my emonPi, also a 32 GB card:

pi@emonpi:~ $ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
mmcblk0 179:0 0 29.7G 0 disk
├─mmcblk0p1 179:1 0 256M 0 part /boot
├─mmcblk0p2 179:2 0 4G 0 part /
└─mmcblk0p3 179:3 0 25.5G 0 part /var/opt/emoncms
pi@emonpi:~ $

I did the same, but also increased the root partition from 4G to 8G as I was running very close to full and eventually it caused problems. I’m not sure why the root partition was growing as all data is written to /var/opt/emoncms and the log files were limited to 50 MB. If you do want to expand the root partition, you need to move the data partition first to create unused space after mmcblk0p2, then expand the root partition into the free space. It’s quite straightforward with GParted as @Robert.Wall showed.

You want to investigate why. Do you take backups? at one time the backup location pointed to that partition. Have you anything else installed?

sudo du -ah /opt/* | sort -n -r | head -n 30
sudo du -ah /var/* | sort -n -r | head -n 30
sudo du -ah /home/* | sort -n -r | head -n 30

will search the file system for the largest files - it looks in the 3 most common places.

I did look at the time, and couldn’t identify anything, and now of course all is reset back to a fresh install. But I think it may have arisen from installing the desktop version of Raspbian as well - I can’t be sure but some time ago I recall installing the GUI package and that might have blown out the root partition!

It will definitely. The general advice is not to install anything other than emoncms as it can cause issues.