Enlarging FreeBSD Memstick Image

Ron Wills ron at digitalcombine.ca
Mon Mar 1 00:58:11 UTC 2021


On 2/28/21 6:39 PM, Herbert J. Skuhra wrote:
> On Sun, Feb 28, 2021 at 03:27:20PM -0600, Ron Wills wrote:
>> I've taken the FreeBSD memstick image an did a couple little modifications
>> to add a persistent partition that I mount as unionfs's (/etc /usr /var &
>> /root). So far so good. I can bootstrap pkg and install software to the
>> thumb drive and keep wifi configurations and such. Now not only can I
>> install FreeBSD it gives me a very usable live distro.
>>
>> Next step is to bootstrap pkg in the image file itself and have the most
>> common tools I use already installed. First I need to enlarge the image and
>> this is where I'm having problems.
>>
>> $ truncate -s 2G FreeBSD-12.2-RELEASE-amd64-memstick.img
>>
>> $ mdconfig -a -t vnode -f FreeBSD-12.2-RELEASE-amd64-memstick.img -u 0
>>
>> $ gpart recover md0
>>
>> $ gpart resize -i 2 md0
>>
>> Now this is where I'm stuck. The second partition is show 2G but I can seem
>> to resize the filesystem.
>>
>> $ gpart show md0
>> =>      1  4159568  md0  MBR  (2.0G)
>>          1     1600    1  efi  (800K)
>>       1601  4157968    2  freebsd  [active]  (2.0G)
>>
>> $ growfs /dev/md0s2a
>> growfs: requested size 1.0GB is not larger than the current filesystem size
>> 1.0GB
>>
>> I can't figure out why growfs isn't seeing the new partitions size.
> # gpart show md0s2
> # gpart resize -i 1 md0s2
> # growfs /dev/md0s2a
>
Perfect, that worked. I guess ufs works a bit differently than I 
expected. I have some reading to do. Thanks!


More information about the freebsd-questions mailing list