Increase root partition on local emonSD-21Jul21

I am running a local emoncms on RasperryPiB+ successfully since couple of month. Works excellent and fast.
Now I am running out of space on root. How can I increase the root partition? The card is 32GB and as far as Ican see only ~14GB is used. So how to get the extra 16G added to root?

Filesystem      Size  Used Avail Use% Mounted on

/dev/root        4.1G  3.3G  670M  84% /
devtmpfs       430M     0  430M   0% /dev
tmpfs            463M     0  463M   0% /dev/shm
tmpfs            463M  6.3M  456M   2% /run
tmpfs            5.0M  4.0K  5.0M   1% /run/lock
tmpfs            463M     0  463M   0% /sys/fs/cgroup
tmpfs            1.0M     0  1.0M   0% /var/tmp
tmpfs             30M  4.0K   30M   1% /tmp
tmpfs            1.0M  4.0K 1020K   1% /var/lib/php/sessions
/dev/mmcblk0p1  253M   48M  205M  19% /boot
/dev/mmcblk0p3  9.9G   24M  9.4G   1% /var/opt/emoncms
log2ram          50M  1.9M   49M   4% /var/log
tmpfs            93M     0   93M   0% /run/user/1000

Disk /dev/mmcblk0: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x41d38177

Device         Boot   Start      End  Sectors  Size Id Type
/dev/mmcblk0p1           8192      532479   524288    256M  c W95 FAT32 (LBA)
/dev/mmcblk0p2       532480    9273343  8740864   4.2G 83 Linux
/dev/mmcblk0p3      9273344 30244863 20971520   10G 83 Linux

sudo lsblk
mmcblk0     179:0    0 29.7G  0 disk
├─mmcblk0p1 179:1    0  256M  0 part /boot
├─mmcblk0p2 179:2    0  4.2G  0 part /
└─mmcblk0p3 179:3    0   10G  0 part /var/opt/emoncms

I am wondering about the second 10G linux partition. Can I move it?

This partition is specifically for data and is not a standard configuration to increase disk life. You should be able to expand it with gparted.

Backing up such a large amount of data can be interesting. Do you have a lot of backup files lurking which might be the reason for a full partition?


pi@emonpi:~ $ sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT
mmcblk0            14.5G
├─mmcblk0p1 vfat    256M /boot
├─mmcblk0p2 ext4      4G /
└─mmcblk0p3 ext2   10.1G /var/opt/emoncms

I am surprised you have 10GB of data.

Find 10 largest files

pi@emonpi:/var/opt/emoncms $ sudo find . -type f -exec ls -sh {} + | sort -n -r | head -10
477K ./phpfina/3.dat
130M ./backup/emoncms-backup-2022-06-21.tar.gz
 63M ./phpfina/20.dat
 63M ./phpfina/19.dat
 52M ./backup/emoncms-backup-2020-10-31.tar.gz
 43M ./backup/emoncms-backup-2020-08-19.tar.gz
 40M ./phpfina/7.dat
 40M ./phpfina/6.dat
 40M ./phpfina/2.dat
 40M ./phpfina/1.dat

Sorry, not quite understanding. I see /dev/root increasing, which is under
/dev/mmcblk0p2. So this partition should be increased. The /dev/mmcblk0p3 is behind and you say it is used for data? There is only 24M used.

pi@emonpi:/var/opt/emoncms $ sudo find . -type f -exec ls -sh {} + | sort -n -r | head -10
1023K ./phpfina/14.dat
1023K ./phpfina/13.dat
1023K ./phpfina/12.dat
1023K ./phpfina/11.dat
818K ./phpfina/16.dat
818K ./phpfina/15.dat
207K ./phpfina/20.dat
207K ./phpfina/19.dat
207K ./phpfina/18.dat
207K ./phpfina/17.dat

I don’t think you will find this will change much - that is pretty much what it should be. The Install is optimised for emoncms, so root is relatively small and the bulk of space is left for data.

Yes, sorry, misread your output. :frowning:

OK, my fault, have been searching now and found what is increasing my root space. I forget that motion is also running on this Pi. Works quite well but that is filling the root with mkv files. So I need to move the motion output to the remaining part of the sdcard. I am not an expert on Linux, but learning every day:-) So I need to create a partition with gparted or fdisk, mount it and then set the output of motion to go the new mount. Will that work with emoncms?

Part of the reason why we recommend that the Pi is dedicated to emoncms. If you can, just put them on the data partition so under /var/opt/emoncms.

OK point taken, I should have read the doc first, which recommends it! Thanks any way for your help.

1 Like