Minimal Edition 18.05 resize-sd is not properly working


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



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


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


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


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:


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.


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


I had this to with the


I did above mentioned

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


sudo resize-sd

This will attempt to grow the 'Root (/)' partition to the maximum space on the SDcard
after it is finished, it will grow the filesystem to fill the partition and reboot the device
There is a chance of corruption, loss of data, or even worse so proceed with caution
Press any key to continue ...... 
Error: Invalid number.
Resize parition successful. Growing filesystem to fit partition ......    
resize2fs 1.44.3 (10-July-2018)
The filesystem is already 359680 (4k) blocks long.  Nothing to do!

Filesystem      Size  Used Avail Use% Mounted on
Resize Filesystem successful
Press any key to reboot device .... Connection to closed by remote host.

but it doesnt seem to work because after reboot the size the same as it was

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       1.4G  1.2G  111M  92% /
devtmpfs        464M     0  464M   0% /dev
tmpfs           468M     0  468M   0% /dev/shm
tmpfs           468M  232K  468M   1% /run
tmpfs           468M     0  468M   0% /sys/fs/cgroup
tmpfs           468M     0  468M   0% /tmp
tmpfs            94M     0   94M   0% /run/user/1000

full size of this sd is 16GB. What am I doing wrong?

What is odd when I run fdisk it says that this partition is 15gb:

~ $ sudo fdisk -l /dev/mmcblk0
Disk /dev/mmcblk0: 14.9 GiB, 15931539456 bytes, 31116288 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: 0x843510d5

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1        2048   194559   192512   94M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      194560 31054687 30860128 14.7G 83 Linux

another update :wink:
I do not know what I did but it seems to be fine now.
Cheers. :slight_smile:


Try downloading a newer Minimal image. 18.07 is available.

But what happens if you take out the yes in the resize line:

sudo sed -i '/parted -m/c\parted -m $DEV u s resizepart $PART_NUM $END_SECTOR' /usr/bin/resize-sd


this was 18.07 image issue


Why are you posting in a thread about 18.05 then?

The 18.07 images have a script that worked. At least in my tests.

Why do you sed stuff into it?


why? because this was first result from google :wink:
if the scripts are working now why did I look for solution in first place? :wink: It means that scripts are still faulty!
Best regards.


So you DD’ed the image over to the SD card. Booted your raspberry pi up and ran:
sudo resize-sd

Because that’s what I did, and it worked for me several times in my tests.


yeah, that is exactly what I did, except that the size of 2ed partition did not change I had to run parted manually or something similar to change the size of that partition and then several reboots and then it worked.


Weird. I’ll have a look at it at some point.

What device did you install on?


It’s Raspberry Pi 3 Model B


i downloaded the newest version today and have the same problem.
version: 18.05 mate
is the problem only fixed in minimal edition?


Yes. The MATE edition is not updated yet. If it was, it would have been a newer version than 18.05.


This topic was automatically closed after 90 days. New replies are no longer allowed.