hypriot / rpi-image-builder

**DEPRECATED** Build Raspberry Pi Raspbian images based on custom kernels
0 stars 0 forks source link

firstboot.sh does not expand filesystem if usb drive is connected to RPi #40

Closed StefanScherer closed 9 years ago

StefanScherer commented 9 years ago

From Matthew's comment in our blog post about Docker 1.6.0.

I have encountered a "feature" of the firstboot.sh script. I'd copied some things to a jump drive, pulled the old microsd, put in today's release & booted with the usb jump drive in.

Unfortunately, it ran into the following in firstboot.sh:

# Expand filesystem, but only on real device, not in QEMU
if [ ! -e /dev/sda ]; then
echo 'Expanding rootfs ...' >> /dev/kmsg
raspi-config --expand-rootfs
echo 'Expand rootfs done' >> /dev/kmsg
sleep 5
reboot
fi

The usb drive was mounted as /dev/sda, so the rootfs expansion didn't occur. Perhaps something like this might be better:

if [[ -n "`df |grep mmcblk0p1`" ]]; then 
# resize here
fi
StefanScherer commented 9 years ago

Current build_image.sh script does not have the if /dev/sda anymore.