Archive for July, 2011

Multiboot FreeBSD

July 12, 2011

I have a FAT32 partition with my GRUB, stages, menu.lst, etc. and I have two installs of FreeBSD on their own primary partitions afterwards. Ideally, I would just chainload each partition, and the first boot sector on the partition would handle booting the operating system on that partition. But FreeBSD (and Solaris) are a bit different.

FreeBSD makes it simple enough. All you need to do is root to the first subpartition of the FreeBSD partition and call boot kernel /boot/loader.

However, GRUB needs to be able to read UFS2 in order to load /boot/loader from that UFS2 filesystem, otherwise partition type 0xa5 will be “unknown”. I updated GRUB on the FAT32 partition to support UFS2 stage1.5, among some other strange filesystem types.

I then reinstalled the FAT32 copy of GRUB to the MBR with the usual install (hd0,0)/boot/grub/stage1 (hd0) (hd0,0)/boot/grub/stage2 p (hd0,0)/boot/grub/menu.lst, and voila, the MBR/booted GRUB could read UFS2.

Here’s a sample of my finished menu.lst:
[root@saratoga16a ~]# cat /mnt/fat32/boot/grub/menu.lst
default 0
timeout 8
title FreeBSD 7.4 i386
    root (hd0,1a)
    kernel /boot/loader
title FreeBSD 7.4 amd64
    root (hd0,2a)
    kernel /boot/loader
title Windows
    root (hd0,0)
    chainloader +1
[root@saratoga16a ~]#


Resizing a VirtualBox disk image

July 6, 2011

I won’t go into huge details, but it was pretty straightforward, with some systems experience, and (surprisingly) I did not hit a bunch of errors on the way.

I made the mistake of making an 8GB (default?) fixed image size, and now I made it a 50GB variable image size (the guest OS thinks it has 50GB, but it only uses as much real space as it needs)

  1. Create a new disk under the SATA controller
  2. Boot into a live Linux, like GParted
  3. dd if=/dev/sda of=/dev/sdb (add bs to improve performance!)
  4. Open GParted and extend /dev/sdb to your desired size
  5. Mount your new partition, fix any /etc/fstab-related items as necessary
  6. poweroff, remove the old disk from the virtual SATA controller, power on