Resizing embedded image to full disk size on first boot



  • Not much of an issue for typical m0n0wall, pfSense, or FreeNAS deployments, but if you were using packages, or in my case storing TFTP boot files in the config partition it would be nice to utilize the full space available.

    A thread on FreeBSD small questions raised the tool growfs, so technically you could have a fixed image, e.g. 64MB, then on first boot discover the real disk parameters, re-define the fdisk and bsdlabel parameters and grow the UFS file system to the full disk size.

    I will try this out soon as I had to do it the tedious way with a 512MB card to fit in some amd64 boot images.  The most difficult thing with BSD seems to be determining the disk parameters and ones that keep the UFS label, although some patches made it into CVS fixing some of them.





  • BTW your diagram on the BSD boot process is very useful!

    Scott's reply probably solves your probelm.

    You are right that some of the CHS boot parameters are very confusing. In addition you may find this useful.  My problem was setting up a 4 partiton BSD dev system and using an image utility to transfer between partitons. The```
    bsdlabel -R ad0s1 savedlabel

    using the * options in fields where new values have to be calculated worked very well for me. It recalculates all of the correct parameters and re-writes to "savelabel". I cannot supply you an example because all of the label were re-witten without my knowledge.

Log in to reply