UFS How to resize the root partition after enlarging the hard disk?

I have a virtual machine with FreeBSD inside Virtualbox, the disk is 20GB let's say, and want to enlarge it to 50GB. With Virtualbox tools I just enlarge the disk no problem, but how do I do to resize the root filesystem, which is a freebsd-ufs type at /dev/ada0p4 device?
 
Did you resize the partition first?
 
I tried resizing the live system:

# gpart recover ada0
ada0 recovered
# gpart resize -i 4 ada0
ada0p4 resized
# growfs -y /dev/ada0p4
growfs: /dev/ada0p4: Operation not permitted
service growfs onestart
Growing root partition to fill device
ada0 recovering is not needed
ada0p4 resized


however when I reboot from live CD I get filesystem dirty:

root@livecd:/ # fsck /dev/ada0p4
** /dev/ada0p4
** Last Mounted on
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
UNREF FILE I=1042302 OWNER=ghostbsd MODE=140700
SIZE=0 MTIME=Jan 7 21:54 2023

RECONNECT? [yn] y

NO lost+found DIRECTORY
CREATE? [yn] n

SORRY. CANNOT CREATE lost+found DIRECTORY
UNEXPECTED SOFT UPDATE INCONSISTENCY



CLEAR? [yn] n

UNREF FILE I=1042303 OWNER=ghostbsd MODE=140700
SIZE=0 MTIME=Jan 7 21:54 2023

RECONNECT? [yn] y

NO lost+found DIRECTORY
CREATE? [yn] y

UNREF FILE I=1042304 OWNER=ghostbsd MODE=140700
SIZE=0 MTIME=Jan 7 21:54 2023

RECONNECT? [yn] y

UNREF FILE I=1042305 OWNER=ghostbsd MODE=140700
SIZE=0 MTIME=Jan 7 21:54 2023

RECONNECT? [yn] y

** Phase 5 - Check Cyl groups
FREE BLK COUNT(S) WRONG IN SUPERBLK
SALVAGE? [yn] y

SUMMARY INFORMATION BAD
SALVAGE? [yn] y

BLK(S) MISSING IN BIT MAPS
SALVAGE? [yn] y

419331 files, 4624263 used, 9076011 free (18011 frags, 1132250 blocks, 0.1% fragmentation)

***** FILE SYSTEM STILL DIRTY *****

***** FILE SYSTEM WAS MODIFIED *****

***** PLEASE RERUN FSCK *****
root@livecd:/ # fsck /dev/ada0p4
** /dev/ada0p4
** Last Mounted on
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
UNREF FILE I=1042302 OWNER=ghostbsd MODE=140700
SIZE=0 MTIME=Jan 7 21:54 2023

RECONNECT? [yn] ^C
***** FILE SYSTEM STILL DIRTY *****

root@livecd:/ # fsck -y /dev/ada0p4
** /dev/ada0p4
** Last Mounted on
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
UNREF FILE I=1042302 OWNER=ghostbsd MODE=140700
SIZE=0 MTIME=Jan 7 21:54 2023

RECONNECT? yes

** Phase 5 - Check Cyl groups
419331 files, 4624263 used, 9076011 free (18011 frags, 1132250 blocks, 0.1% fragmentation)

***** FILE SYSTEM MARKED CLEAN *****

***** FILE SYSTEM WAS MODIFIED *****


Can anybody help here? Do I have to do the whole resize from the live CD and not from the mounted root (ada0p4) partition?
 
I see you updated PR 237392 although sadly it seems that PR is untouched by devs. However what Gonéri mentions there might be worth a check/try: do you have DSFs (device special files) under /dev/gpt/ for this disk too? If so can you try using the proper one for ada0p4 from there?
 
Back
Top