Enlarging FreeBSD Memstick Image

Ron Wills ron at digitalcombine.ca
Sun Feb 28 21:27:31 UTC 2021

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 

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.

More information about the freebsd-questions mailing list