[Pkg-raspi-maintainers] RFC: extending the root partition/file system on first boot

Michael Stapelberg stapelberg at debian.org
Thu Feb 16 08:35:48 UTC 2017


I wrote a Perl script which can be plugged into the boot process to extend
the root partition and root file system. The result is that the user is
greeted with a fully extended root file system on first login (see
screenlog.0).

Here’s how to install the script on top of the preview image:

sudo dd if=2016-11-24-raspberry-pi-3-stretch-PREVIEW.img of=/dev/sdb bs=5M
pmount sdb2
sudo cp ~/resizerootfs /media/sdb2/usr/bin/
sudo chmod +x /media/sdb2/usr/bin/resizerootfs
sudo cp ~/resizerootfs.service /media/sdb2/etc/systemd/system/
sudo mkdir
/media/sdb2/etc/systemd/system/systemd-remount-fs.service.requires/
sudo ln -s /etc/systemd/system/resizerootfs.service
/media/sdb2/etc/systemd/system/systemd-remount-fs.service.requires/resizerootfs.service
pumount sdb2
pmount sdb1
sed -i 's,elevator,rw elevator,g' /media/sdb1/cmdline.txt
pumount sdb1

One thing I still need to change is that resizerootfs should, after
successful completion, disable resizerootfs.service (i.e. remove the
symlink), so that the user has full control over the partition table after
the first boot.

I’ll also add a safety-guard to resizerootfs to not touch the partition
table in case partition 3 and 4 already exist, just in case the user
applies their own partition layout before ever booting the image.

Any thoughts/comments? If not, I’ll go ahead and build a new preview image
with the script included.

-- 
Best regards,
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-raspi-maintainers/attachments/20170216/ffed80c8/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: screenlog.0
Type: application/octet-stream
Size: 22499 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-raspi-maintainers/attachments/20170216/ffed80c8/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: resizerootfs
Type: application/octet-stream
Size: 4150 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-raspi-maintainers/attachments/20170216/ffed80c8/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: resizerootfs.service
Type: application/octet-stream
Size: 205 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-raspi-maintainers/attachments/20170216/ffed80c8/attachment-0005.obj>


More information about the Pkg-raspi-maintainers mailing list