It should be doable with the following rc.d configuration:
resize_disklabel=YES
resize_root=YES
The second script is available by default, but the first one is somehow hidden from general availability:* http://bxr.su/n/distrib/utils/embedded/files/resize_disklabe...
* http://bxr.su/n/etc/rc.d/resize_root
You can fetch it raw, it seems to work great:
cd /etc/rc.d/
ftp http://bxr.su/raw/NetBSD/distrib/utils/embedded/files/resize_disklabel
chmod +x resize_disklabel
The `resize_disklabel` script does handle `fdisk`, too. If it doesn't work for your usecase, might want to provide the output of running `/etc/rc.d/resize_disklabel` manually, together with `fdisk` and `disklabel` outputs, too.P.S. BTW, you probably don't want to run `resize_root onestart` once the system is running multiuser — it passes `-y` to `resize_ffs`, which causes temporary filesystem corruption if the filesystem is running in `rw` mode.
Aye, but that doesn't seem to work. Check out the genimg script - it's already trying to set up resize_root. I've also tried resize_disklabel without success. What this needs isn't another well-meaning HN comment trying to debug by proxy - I need someone who knows how NetBSD works to get their hands dirty and get it done.
The resize_root script wouldn't do anything if the fdisk and disklabel aren't adjusted (provided it's not a raw filesystem file that's being resized as in http://wiki.netbsd.org/amazon_ec2/build_your_own_ami/ page), so it's kind of expected that it doesn't work all by itself, and that https://git.sr.ht/~sircmpwn/builds.sr.ht/tree/master/images/... is wrong.
Re:NetBSD 9.0
by tedunangst on Saturday February 15, 2020 @05:14PM
(#22338386)
You should be able to create a vnd that's larger than the host filesystem if you don't fill it.
https://git.sr.ht/~sircmpwn/builds.sr.ht/tree/master/images/...
But I need a NetBSD expert to come in and put on the finishing touch: making the filesystem resize to fill the available space on the qcow2. Without this, the image cannot build a new version of itself which isn't smaller than the host image, leading to image shrinkage over time and eventual breakitude.