UFS Problems with growfs and corrupt GPT in a fresh VirtualBox FreeBSD guest

Hello everyone,

I downloaded the FreeBSD 12.1 vhd from official website and used it to create a guest FreeBSD in VirtualBox.
When run at the first time, the kernel produced regularly error messages telling the disk was full. It was impossible to start the very first steps described in the handbook.

So, at first, I used the virtual media manager of VirtualBox to enlarge the disk. Then I followed the steps described in the disks-growing chapter of the handbook. Anytime I used gpart, it ended up with a lot of error messages, yet it seemed to have managed to do what was required (the GPT partition table was not marked as corrupt anymore and the correct partition was resized as desired). I cannot join a copy of these error messages since there is yet no way to copy the text of the FreeBSD console, so I insert a screenshot of it at the end of this post (this screenshot having been made later, after the filesytem had actually been resized).

But then the final growfs call returned Operation not permitted.
I was logged in as root and also ran sysctl kern.geom.debugflags=16 before, and yet this error showed up.

As a solution (or workaround) I found that running service growfs onestart (source) solved the problem.
I don't know if this is correct or a dirty hack.

There's still a problem though: each reboot shows that the GPT table is corrupt. I run gpart recover ada0, what ends up with the Input/output error shown in the screenshot below, but gpart show tells GPT is not marked corrupt any more.

vb_freebsd_gpart_errors.png


What is the way to permanently recover the GPT?
Maybe I am not correctly shutting down the machine? ( shutdown -h now and when ready, power off from VirtualBox dialog).
 
First of all, this isn't the first time this kind of pre-made disk strikes. As soon as you run it, df -h show a size of 2.9G for the freebsd-ufs partition and 2.8G is used... Disk is full before to begin. Impossible to add any package. How can people test FreeBSD with such a disk?

The best to do is to set up your own VM (disk size 10G at least) and install FreeBSD with its iso file. It's quick and demands very little knowledge.

Concerning your current problem, a procedure that works is:
- Enlarge disk with the media manager of VirtualBox (you mustn't have any snapshot).
- Start your VM and enter these commands as root:
gpart recover ada0
gpart resize -i3 ada0
growfs /


Then, reboot.
 
The best to do is to set up your own VM (disk size 10G at least) and install FreeBSD with its iso file. It's quick and demands very little knowledge.
One thing to note though, by default the freebsd-swap partition gets installed at the end. You'll want to swap freebsd-ufs and freebsd-swap around so the freebsd-ufs (or freebsd-zfs) partition is the last partition of the disk. That will make future enlargements easier and freebsd-swap won't get in the way.

Useful ports to install on the image: sysutils/firstboot-freebsd-update, sysutils/firstboot-growfs and sysutils/firstboot-pkgs.
 
First of all, this isn't the first time this kind of pre-made disk strikes. As soon as you run it, df -h show a size of 2.9G for the freebsd-ufs partition and 2.8G is used... Disk is full before to begin. Impossible to add any package. How can people test FreeBSD with such a disk?

Well a full disk before the very first login is a bit unexpected indeed. This situation (and how to solve it) is not mentioned in the VirtualBox chapter of the HandBook.

The best to do is to set up your own VM (disk size 10G at least) and install FreeBSD with its iso file. It's quick and demands very little knowledge.

I think I will switch to this way of installing FreeBSD in VirtualBox.

Concerning your current problem, a procedure that works is:
- Enlarge disk with the media manager of VirtualBox (you mustn't have any snapshot).
- Start your VM and enter these commands as root:
gpart recover ada0
gpart resize -i3 ada0
growfs /


Then, reboot.

Well I've done all this again with a brand new fresh created FreeBSD VirtualBox guest from a re-downloaded FreeBSD 12.1 vhd from official website, and I get the same results as described in the first post (except for the growfs's Operation not permitted error): at next reboot gpart shows that ada0 is corrupt, then gpart recover ada0 produces a lot of errors but then gpart show shows ada0 is not corrupt anymore, until the next reboot.

So I will use the iso file as you advised. Thanks for your time and advices!
 
Well I've done all this again with a brand new fresh created FreeBSD VirtualBox guest from a re-downloaded FreeBSD 12.1 vhd from official website, and I get the same results as described in the first post (except for the growfs's Operation not permitted error): at next reboot gpart shows that ada0 is corrupt, then gpart recover ada0 produces a lot of errors but then gpart show shows ada0 is not corrupt anymore, until the next reboot.
It's weird. It worked perfectly for me with the same vhd you took and VirtualBox (under Windows 7). I got no error at all. I just restarted this VM once more and the partitioning scheme is still no corrupted (well, it's the expected behaviour).

Maybe something is wrong with your hardware or software.
 
That's weird indeed. The host is a Linux Manjaro almost up to date (Virtual Box is up to date).
Anyway, I've used the iso file and it works fine!
Thank you!
 
… the Input/output error shown in the screenshot below, …

I had the same problem with the FreeBSD-provided disk for 12.2-RELEASE:

<https://bz-attachments.freebsd.org/attachment.cgi?id=221624>

From <https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=252734#c10> (2021-01-17):

… Part of the confusion is that gpart recover fails to recover the GPT (not only as outlined above); I'll take this problem to the freebsd-current list.

– from which I assume that there was the same problem with FreeBSD 13.0-CURRENT.

I don't recall taking the problem to the list. I sense some disinterest in testing FreeBSD-provided virtual disks.
 
Back
Top