When I first created bonzo, I allocated 96MB of RAM in VMWare. As I ran Gallery 2, Drupal, ByteHoard, etc, it became clear from the out-of-memory errors that I needed to boost the memory space. I since increased the allocation to 256MB, but the swap file is still only 160MB. Consequently, I’m plagued by kernel out of space space errors like:
Dec 5 18:09:18 bonzo kernel: swap_pager_getswapspace(6): failed
and
Dec 6 03:03:07 bonzo kernel: swap_pager: out of swap space
Dec 6 03:03:07 bonzo kernel: swap_pager_getswapspace(4): failed
Dec 6 03:03:07 bonzo kernel: pid 15958 (httpd), uid 80, was killed: out of swap space
I’ve expanded bonzo’s virtual disk by an additional gigabyte, using the steps from my previous post on growing VMWare disks, and now I need to get FreeBSD to use that new space as swap.
I ran sysinstall to go through the FreeBSD installer again, which is how I created the FreeBSD disk label initially. The disk label is what I as a Windows guy would think of as the partition table; it’s the list of partitions on the disk and their file system types.
To access the disk labeler again I went to ‘Expert’ mode in the installer, then chose ‘Label’. I hit ‘C’ to create a new label, and got:
Not enough space to create an additional FreeBSD partition
Sure enough, the label editor shows:
Disk: ad0 Partition name: ad0s1 Free: 0 blocks (0MB)
Clearly it doesn’t ‘see’ the 1GB I added to the end of the disk.
When I first accessed the ‘Label’ function, I got:
│WARNING: A geometry of 113179/15/63 for ad0 is incorrect. Using │
│a more likely geometry. If this geometry is incorrect or you │
│are unsure as to whether or not it's correct, please consult │
│the Hardware Guide in the Documentation submenu or use the │
│(G)eometry command to change it now. │
│ │
│Remember: you need to enter whatever your BIOS thinks the │
│geometry is! For IDE, it's what you were told in the BIOS │
│setup. For SCSI, it's the translation mode your controller is │
│using. Do NOT use a ``physical geometry''. │
However, I get that alot for large disks or RAID arrays, not just VMware disks, so I didn’t pay it any mind. Perhaps I should.
Apparently there is a tool, growfs, which has been in the FreeBSD base install for years. From the growfs(8) man page:
The growfs utility extends the newfs(8) program. Before starting growfs
the disk must be labeled to a bigger size using bsdlabel(8). If you wish
to grow a file system beyond the boundary of the slice it resides in, you
must re-size the slice using fdisk(8) before running growfs.
Awesome. So I have to resize the slice with fdisk, label the disk to a bigger size with bsdlabel, and only then can I expand the filesystem with growfs. Hmm. I’ll try later.
UPDATE: I wimped out. I’m rather scared to death of damaging bonzo’s filesystem. Even though it’s backed up nightly to jane, that doesn’t mean I relish the prospect of rebuilding the filesystem under duress. Thus, I’ve taken the easy way out; I’ve added a new, 2GB hard drive using VMware, and will make that into a swap volume.
I ran sysinstall again, to use its GUI fdisk-er and label-er. I’ve created a single partition, ad1s1b, which is a 2GB swap partition. I’ve added it to /etc/fstab (sysinstall tried, but the kernel hadn’t picked up the newly created filesystem on /dev/ad1 yet, so it failed. Not a big deal.). A reboot, and I’ll inspect my handiwork.
Sweet:
bonzo# swapinfo
Device 1K-blocks Used Avail Capacity
/dev/ad0s1b 162632 0 162632 0%
/dev/ad1s1b 2097112 0 2097112 0%
Total 2259744 0 2259744 0%