emonSDexpand on 30Oct18 Raspbian Stretch Image

That’s great, good spot. I’ve just tested and merged. Thank a lot :+1:

This fix will be included in all emonPi/emonBase/emonSD units by default. Existing users can pull in the fix via admin > emonpiupdate.

For reference here is the output I got expanding to a 16Gb card:

Current Disk Info:
Disk /dev/mmcblk0: 14.5 GiB, 15552479232 bytes, 30375936 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: 0x50c2568e

Device         Boot   Start      End  Sectors  Size Id Type
/dev/mmcblk0p1         8192    96663    88472 43.2M  c W95 FAT32 (LBA)
/dev/mmcblk0p2        98304  8290303  8192000  3.9G 83 Linux
/dev/mmcblk0p3      8290304 30273536 21983233 10.5G 83 Linux

======================================================

Proposed changes to be made:
 SD card total disk size = 14.484375Gb
 Data Partition size     = 10.4824223518Gb

Are you sure you want to proceed? [Y/n] 

Command (m for help): The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

This error message can however be disregarded, because your system
is about to be rebooted, and the new partition table will then be
read by your operating system.

Writing the resize2fs_once script


======================================================================

So far, so good... in 20s your system will reboot
and resize the /home/pi/data filesystem to fill the resized partition.
**THIS OPERATION WILL TAKE UP TO 20 MINUTES**
When completed the Pi will poweroff and close down.
PLEASE DO NOT UNPLUG THE POWER FOR AT LEAST 30min
because it will likely result in an unusable filesystem.

=====================================================================

Then after waiting for the unit to shutdown then reboot:


pi@emonpi:~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       3.9G  1.6G  2.2G  42% /
devtmpfs        484M     0  484M   0% /dev
tmpfs           489M     0  489M   0% /dev/shm
tmpfs           489M  6.6M  482M   2% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           489M     0  489M   0% /sys/fs/cgroup
tmpfs            50M  208K   50M   1% /var/log
tmpfs           1.0M     0  1.0M   0% /var/tmp
tmpfs            30M     0   30M   0% /tmp
/dev/mmcblk0p1   43M   22M   21M  52% /boot
/dev/mmcblk0p3   11G  113M  9.7G   2% /home/pi/data
tmpfs            98M     0   98M   0% /run/user/1000

Mmm it seems mariadb is down after the expansion process using the update emonSDexpand. Has anyone else experienced this?

● mariadb.service - MariaDB database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: 
   Active: failed (Result: exit-code) since Tue 2018-11-27 15:54:04 UTC; 4min 54
  Process: 838 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSR
  Process: 743 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR=
  Process: 739 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_
  Process: 735 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run
 Main PID: 838 (code=exited, status=1/FAILURE)
   Status: "MariaDB server is down"

Nov 27 15:53:56 emonpi systemd[1]: Starting MariaDB database server...
Nov 27 15:53:58 emonpi mysqld[838]: 2018-11-27 15:53:58 1988366336 [Note] /usr/s
Nov 27 15:54:04 emonpi systemd[1]: mariadb.service: Main process exited, code=ex
Nov 27 15:54:04 emonpi systemd[1]: Failed to start MariaDB database server.
Nov 27 15:54:04 emonpi systemd[1]: mariadb.service: Unit entered failed state.
Nov 27 15:54:04 emonpi systemd[1]: mariadb.service: Failed with result 'exit-cod

It worked for me

● mariadb.service - MariaDB database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2018-11-27 00:31:05 UTC; 1 day 18h ago
Main PID: 860 (mysqld)
Status: "Taking your SQL requests now..."
CGroup: /system.slice/mariadb.service
└─860 /usr/sbin/mysql

Nov 27 00:31:00 emonpi systemd[1]: Starting MariaDB database server...
Nov 27 00:31:02 emonpi mysqld[860]: 2018-11-27 0:31:02 1988608000 [Note] /usr/sbin/mysqld (mysqld 10.1.23-MariaDB-9+deb9u1) starting as process 860 ...
Nov 27 00:31:05 emonpi systemd[1]: Started MariaDB database server.