Minimal Edition 18.05 resize-sd is not properly working


#1

Hi there,
the resize-sd was not properly working with my SD card.
The errormessage was something like “autofs was not big enough”.

I just made it manually at my other pc:

# resize2fs /dev/device size

Cheers
Steffen


#2

Yeah. We know that. Found out it’s because parted was not installed by default.


#3

I could be wrong here, as I am currently trying out the MATE version (v18.05) for RPi2/3, but it also gets the

Error: The device /dev/autofs is so small that it cannot possibly store a file system or partition table.  Perhaps you selected the wrong device?
Warning: Error fsyncing/closing /dev/autofs: Invalid argument
Retry/Ignore?

message.

I found this is because the line

PART_DEV=grep -Eo 'root=[[:graph:]]+' /proc/cmdline | cut -d "=" -f 2-

returns a UUID, not the intended /dev/mmcblk0p2, and hence the entire script fails after that point.

If you correct that though, it fails again, because the parted line does not contain a “yes” between the partition number and the ending sector. Without this, you’ll get a “parted: invalid token” error.

Finally, the df command towards the end doesn’t provide useful output to the end user, and could lead to confusion, so I changed that a bit.

This was quick and dirty (and error-prone running blindly), but I ran the following on my system to get the script working for me. Naturally, something better would make it into the final script, and perhaps has already, but this was good enough at the time.

sudo sed -i '/PART_DEV=/c\PART_DEV="/dev/mmcblk0p2"' /usr/bin/resize-sd
sudo sed -i '/parted -m/c\parted -m $DEV u s resizepart $PART_NUM yes $END_SECTOR' /usr/bin/resize-sd
sudo sed -i '/df -h/c\df -h | egrep "Filesystem|$PART_NAME"' /usr/bin/resize-sd

#4

I think it returns PARTUUID instead of UUID.
Either way, that makes sense, since we had to change to use PARTUUID to support USB boot in RPI3/RPI3+

Thanks for finding this :smile:


#5

You are correct. It’s PARTUUID, not UUID. I had run the grep command on my Manjaro installation on my laptop here, and it returns a UUID value instead, and so I guess that explains me getting that somewhat wrong. :slight_smile:

In any case, I suppose it wouldn’t be too hard to fix correctly, but as you can see, I went for hardwiring of the PART_DEV variable value, and then just slightly modified the parted and df lines to get them working.


#6

Yeah, I think that findmnt / -o source -n would do the trick more dynamically