Root as ZFS / Boot as UFS on Sparc64

Having recently returned to FreeBSD from a 4 year stint with Gentoo, I decided to switch most of my systems back to FreeBSD (a few still run Gentoo). I've been using FreeBSD since 1998 and it proved to be a solid OS back then while I was a Radioman in the Navy (operating on a small P166 server in the ships library). I'm glad things are better now that ZFS is out.

Enough about me, let's get down to getting ZFS working on your Sparc64-based system.

1. Build your disk partitions. You can adjust the sizes to your taste.
Code:
sunlabel -B ada0
gpart destroy -F ada0
gpart create -s vtoc8 ada0
gpart add -s 192M -t freebsd-ufs /dev/ada0
gpart add -s 1G -t freebsd-swap /dev/ada0
gpart add -t freebsd-zfs /dev/ada0

2. Load the appropriate modules to get ZFS working.
Code:
kldload /boot/kernel/opensolaris.ko
kldload /boot/kernel/zfs.ko

3. Create the ZFS pool and adjust checksum and compression settings. I would suggest keeping the checksum settings. If you want to change the compression or disable it altogether, go ahead.
Code:
zpool create -f -m /mnt zroot /dev/ada0d
zpool set bootfs=zroot zroot
zfs set checksum=fletcher4 zroot
zfs set compression=lzjb zroot
zfs create zroot/usr
zfs create zroot/var
zfs create zroot/tmp
zfs create zroot/data
chmod 1777 /mnt/tmp
zpool export zroot
zpool import -o cachefile=/tmp/zpool.cache zroot

4. Mount your UFS /bootdir partition.
Code:
mkdir /mnt/bootdir
newfs -m 0 /dev/ada0a
mount /dev/ada0a /mnt/bootdir

5. Extract the .txz files onto your system.
*NOTE* I have the /usr/ports on a dedicated server due to having several FreeBSD servers running. That way I don't waste valuable space. If you want to add the ports collection, just add ports.txz after doc.txz below.
Code:
cd /usr/freebsd-dist
export DESTDIR=/mnt
for file in base.txz kernel.txz doc.txz games.txz ; do (cat $file | tar --unlink -xpJf - -C ${DESTDIR:-/}) ; done
cp /tmp/zpool.cache /mnt/boot/zfs/zpool.cache

6. Chroot into your system so you can change some of the system files.
Code:
chroot /mnt
Code:
echo 'zfs_enable="YES"' > /etc/rc.conf
echo 'hostname="server.example.lan"' >> /etc/rc.conf
echo 'ifconfig_dc0="DHCP"' >> /etc/rc.conf
echo 'sshd_enable="YES"' >> /etc/rc.conf
echo 'zfs_load="YES"' > /boot/loader.conf
echo 'vfs.root.mountfrom="zfs:zroot"' >> /boot/loader.conf
echo 'vfs.zfs.prefetch_disable="1"' >> /boot/loader.conf
echo 'console="ofw"' >> /boot/loader.conf
mv boot bootdir/
ln -s bootdir/boot /boot
chflags -h sunlink /boot

7. Edit your /etc/fstab to include these lines:
Code:
# Device	Mountpoint	FStype	Options	Dump    Pass#
/dev/ada0a      /bootdir	ufs	rw      0       0
/dev/ada0b      none		swap	sw      0       0

8. Create a password for your system, change your timezone, and create aliases for the mail system.
Code:
passwd
Code:
tzsetup
Code:
cd /etc/mail
make aliases

9. Leave the chroot.
Code:
exit

10. Unmount the entire filesystem and create mountpoints for the ZFS filesystem.
Code:
cd
umount /mnt/bootdir
zfs umount -a

zfs set mountpoint=legacy zroot
zfs set mountpoint=/tmp zroot/tmp
zfs set mountpoint=/var zroot/var
zfs set mountpoint=/usr zroot/usr
zfs set mountpoint=/data zroot/data

11. Reboot the system and you're done with the initial install.
Code:
reboot

This entire script took a SunFire V100 about 10 minutes to install FreeBSD 9.0-RELEASE on a ZFS filesystem with lzjb compression. Not bad for an UltraSPARC IIe.
 
I've tried this 3 times on a 420R and get the same result each time...

Code:
Boot device: /pci@1f,4000/scsi@3/disk@0,0  File and args: 
The file just loaded does not appear to be executable.
{0} ok

I noticed strange SCSI errors on the CD device with the RC2 disk, thought they might be related so I downloaded again and made a new DVD. Twice.

I don't suppose it's that I don't have ada0, but da0 for disks?
 
It shouldn't matter. You can always do a basic install using the CD/DVD, then go back and follow the script.

I had a grouchy SunFire V100 that wouldn't cooperate. I used the installer on FreeBSD 9.0-rc1, rebooted it, then installed it via the script. Worked perfectly. It'll probably work better once -RELEASE comes out.
 
I think
Code:
sunlabel -B ada0
is all that's missing (probably best after gpart). This will write the bootblock to the disk.
 
Back
Top