Expanding Filesystem

Just flashed the Oct18 image to an SD Card with Etcher.

I want to expand the file system but raspi-config comes back with mmcblk0p2 is not the last partition.

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 15125000 6834697  3.3G 83 Linux
pi@emonpi:/var/log $ sudo blkid -o list
device              fs_type   label     mount point            UUID
-------------------------------------------------------------------------------------------------------------------------------
/dev/mmcblk0p1      vfat      boot      /boot                  3725-1C05
/dev/mmcblk0p2      ext4      rootfs    /                      fd695ef5-f047-44bd-b159-2a78c53af20a
/dev/mmcblk0p3      ext2                /home/pi/data          9d452b0a-cb89-4ec2-a32c-6b85dcbcc1c2
/dev/mmcblk0                            (in use)
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   50M  440M  11% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           489M     0  489M   0% /sys/fs/cgroup
tmpfs            30M   20K   30M   1% /tmp
tmpfs            50M   28M   23M  55% /var/log
tmpfs           1.0M     0  1.0M   0% /var/tmp
/dev/mmcblk0p3  3.3G  113M  3.0G   4% /home/pi/data
/dev/mmcblk0p1   43M   22M   21M  52% /boot
tmpfs            98M     0   98M   0% /run/user/1000

I’m not completely comfortable with what needs to be done to expand the file system.

What size sd card is this? It looks like the fs is expanded already since you have 2.2G space on the root fs and 3G left in the data partition.

The 3rd partition has always blocked raspi-config from being used, there is a OEM utility called emonSDexpand (or something similarly named) that is aimed at expanding both the root and data partitions, I think it can be run manually but is included in the emonsd image to run when the image is first run AFAIK.

[edit - I just looked for where is gets expanded for another discussion and cannot find it, maybe the image doesn’t auto expand, if that’s the case the image must come semi-expanded (ie it wasn’t reduced before being packaged)]

Ah yes. Solution is as per documentation :frowning:

sudo emonSDexpand
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   13M  476M   3% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           489M     0  489M   0% /sys/fs/cgroup
tmpfs            50M  128K   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

warning, you can login by SSH while it is happening but the p3 is apparently missing. As the Pi does not actually shutdown and the LCD does not change, it is difficult to know if it has finished. Not being able to SSH indicated to me it was done.

Saw this when looking for something else

The filesystem was not reduced like previous/other images

1 Like