Solved Unable to 'grow' filesystem on USB installation media

I want to add some additional packages to the installation media, so I thought it'd be as simple as:

dd if=ISO-image of=/dev/da0
gpart delete -i 2 da0
gpart add -t freebsd -b 66585 da0
growfs da0s2a

However, whenever I attempt to growfs, it complains:
growfs: requested size 7.0GB is larger than the available 1.1GB

I also tried with the device, da0s2, but then it complains
growfs: superblock not recognized

I'm sure this must be possible, but haven't found a way to do this. For the record, I am able to add some files; however, the additional packages I want to add will be > 1 GB alone whereas the files I had added previously were about 1 MB in total.
 
See manual for gpart resize.
You must use the partitions index.
Then growfs.

With gpart resize on MBR scheme you must resize the partition then the slice.
So write image, run gpart resize twice then growfs.
 
Note how you have to resize disk then slice on MBR resize:
 
seems to indicate that I need to use label
No need. It is already labeled. You do not mount it so label does not matter.

Instructions for FreeBSD 13.1-RELEASE Memstick Image on /dev/da0.
1> dd if=FreeBSD-13.1-RELEASE-amd64-memstick.img of=/dev/da0 bs=1M conv=sync status=progress
2> gpart resize -i 2 da0
3> gpart resize -i 1 da0s2
4> growfs /dev/da0s2a
 
seems to indicate that I need to use label.
I see what you are referencing.
growfs -y /dev/ufs/FreeBSD
Notice the difference. Inside the VM compared to an USB drive installation not even mounted.
Obviously this VM disk image used labels.

Regardless I do hate labels in most instances.
My stock loader.conf has these.
kern.geom.label.ufs.enable=0
kern.geom.label.ufsid.enable=0
kern.geom.label.gptid.enable=0
kern.geom.label.gpt.enable=0

You shouldn't need these but sometimes they do get in the way of manipulating a disk.
 
I am able to add some files; however, the additional packages I want to add will be > 1 GB alone
So you need to decide how you are going to do this.
Now that I showed how to expand your disk you could consider this method.

Lets say you have machine(s) without internet and you want packages.
Use pkg add on the new machines after you install FreeBSD.

Take your free space you now have and make a temp directory like /pkg-add
In it you will add all the packages you want to add in the *.txz format.

You must also include the right packager package*.txz.

The pkg-add files can be scraped from /var/cache/pkg/ of the donor machine.
Make sure same arch and OS version.
Copy the desired txz files into your /pkg-add directory on your FreeBSD Memstick Installer.

Install FreeBSD like normal and then after the installation is over remove memstick.
Then setup your new installation and after mount your memstick and use pkg-add.
Use pkg-static to bootstrap pkg from your memstick /pkg-add directory.

Then pkg add your desired packages.
Do be aware this is easiest with packages that have minimal package dependencies.

 
I have a wrapper to the freebsd-installer that sets up my system to be identical to my running copy. It also takes a snapshot of live data and then restores that onto the new system so I can just switch computers. These scripts got a little more complex and rely on gnugrep gsed and git (using git for configuration). Those pull in a few dependencies, which I think is about 250 MB or so. An earlier version of my scripts did all of their magic without those tools, but weren't as robust. I should really program this in a real programming language, but it is quite amazing what you can do with shell scripts alone.
 
Back
Top