Saturday, March 14, 2009

FreeBSD Installation and ZFS

Its very important that you learn something regardless whether its everyday, every week, every month or at anytime. In my case I learned something new from the alphabet. Having to use the letters C, D, and M apart from A makes me feel good that I am moving forward. Although I'm still using Sysinstall for my FreeBSD Installation. The important thing is I learned to use these letters on my FreeBSD 7.1 Installation sitting on a ZFS root.

I am using an AMD Phenom Quad-Core Processor with 2GB of memory b0x under FreeBSD 7.1 AMD64 over this installation process. And then I followed the instructions that was given here http://www.ish.com.au/solutions/articles/freebsdzfs. I modified some intructions from here because of the problems that I encountered and because of the fact that I'm an idiot.

ZFS on FreeBSD Installation


The installer does not support ZFS natively so we'd have to make our hands dirty.
  • Boot up on the FreeBSD 7.1 CD Installer
  • Choose the Country and Locale
  • Choose Custom Installation
  • Partition the Hard Disk (Use A = Use Entire Disk and Press Q = Quit)
  • Select Standard (Install a standard MBR)
  • Label the Hard Disk (Use A = Auto Defaults)
  • Select the /usr, /var, /tmp Mount Points one at a time and press D (Delete)
  • Leave only the / and the swap partitions
  • Press C to create a new partition and then type /anything as the Mount Point
  • Select the newly created partition and press M (Mount pt) to clear the field by deleting /anything and then press Q to quit
  • Select on Distribution and choose Minimal Install
  • Select Media and choose CD/DVD
  • Select on Commit to install the Operating System

Create the ZFS Pool
  • After the Installation has been completed, remove the CD installer and reboot
  • Boot on the FreeBSD partition and press 4 to boot in Single User Mode
  • Accept the /bin/sh shell by hitting the ENTER key
I am currently using a SATA device at ad4. Follow the instructions below:
# mount -w /
# zpool create tank /dev/ad4s1d
# zfs set mountpoint=none tank
# zfs create tank/root
# zfs create tank/usr
# zfs create tank/var
# zfs set mountpoint=/tank tank/root
# zfs set mountpoint=/tank/usr tank/usr
# zfs set mountpoint=/tank/var tank/var
# zfs set mountpoint=/tank/tmp tank/tmp
# zfs create tank/tmp
And to see what we've done so far
#df -h
And...
#zfs list
Now to enable ZFS on boot...
# echo 'zfs_enable="YES"' >> /etc/rc.conf
And to give us a workable FreeBSD installation under ZFS...
# find -x / | cpio -pmd /tank 

Solving the FreeBSD Boot Problem

# rm -rf /tank/boot
# mkdir /tank/bootdir
# cd /tank
# ln -s bootdir/boot boot
# echo 'zfs_load="YES"' >> /boot/loader.conf
# echo 'vfs.root.mountfrom="zfs:tank/root"' >> /boot/loader.conf
Next is editing our /etc/fstab to:
/dev/ad4s1a  /bootdir        ufs     rw      1       1
Setting the true mountpoints:
# zfs set mountpoint=/tmp tank/tmp
# zfs set mountpoint=/usr tank/usr
# zfs set mountpoint=/var tank/var
And for the legacy:
# cd /
# zfs set mountpoint=legacy tank/root
Reboot and we're ready to go!
# df -h

"Now What?"

1 comment: