UPDATE 1: You cannot blindly cut and paste the commands below and get any results. You must read and understand what is happening from one command to the next. This is an example, which is intended to provide a practical example of how to do this yourself.

Below is (an admittedly quick and dirty) terminal session save in which I was able to grow the FreeBSD filesystem to fill my 16GB SDHC card for Raspberry Pi. I am still a little fuzzy on the math, but it seems that 2150400 is the magic multiplier for gigabytes. That is, 13.8GB * 2150400 = 29675520, which is the number I used for size when adding the partition. Note that the freebsd-ufs partition must start where it originally did when you delete and then re-add it. Also note that the SD card was not mounted while I was working on it. I plugged it in to another FreeBSD system to manipulate the sizes.

7 thoughts on “Resizing FreeBSD partitions on an SD card for Raspberry Pi Using gpart and growfs”

Hi
Thank you very much for posting this.
I had tried for quite some time to enlarge the size of the FreeBSD RPi slice (on a 8GB SDCard) until I found your post.
However, although I tried a number of times, FreeBSD never booted from the enlarged slice even though I had no problem booting before applying the gpart resizing.

The only way I could get it to boot was by dumping the slice to a usb key then resizing it as you outline.
Afterwards, I restored the dump to the enlarged slice and this booted without any problems.

Thanks for your feedback, Paul. Not sure why you had trouble booting, but this is a little new to me too, so I can’t offer any advice on that one. To be clear, I did not move slices to a USB key, but I plugged by SD card into a USB card-reader. This is because you cannot manipulate slices like that when they are mounted. It’s good to know that the dump/restore method works as well.

It’s great… My first attempt with 16G SD card failed (just like Paul’s comment above, unable to boot), maybe because I “copied” all your steps without doing little bit of the math (the sectors numbers may differ). Second try with 8GB card was successful. Although I did not leave enough space for swap and I must go few steps back and re-do what I did, it works and it boots. I can read manual thousand times but I don’t understand until I see real example. Thank you for sharing this with us.

This was a very helpful guide. I also have a 16GB SDHC card for which I wanted to use the whole space, but I ran into a similar issue as the previous commenters with it not booting after following these steps. I ended up finding a fix to my problem, which involved our partition offsets being a bit different. When intially setting up my RasPi, I used the disk image provided here and dd’ed it straight to the SD card, so bear that in mind.

It seems the key is to pay attention to the output of the first ‘gpart show’. If, as in your example, it shows 126k of free space before the freebsd-ufs partition on da1s2 (or whatever the slice is), then your instructions should work. However, my da1s2 didn’t have any free space before freebsd-ufs, so the ‘-b 252’ offsets in later commands obviously (in hindsight) wouldn’t work. To fix this, I replaced all instances of ‘-b 252’ in your procedure with ‘-b 0’. Once I started over with the steps and made those replacements, it booted quite happily.