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?"

Friday, March 13, 2009

FreeBSD Tuning and ZFS

INTRODUCTION

Norbert Copones (http://www.feu-nrmf.ph/norbert/weblog/) have been a very BAD influence for me since puberty. One of the many things he influenced me with is the Z File System or ZFS. I tried Open Solaris 2008.11 first but I was bored to its performance most specially with the gnome desktop. How I wish I could take it off and just have a very minimal installation -- just like Norbert did. Now, since my first love have always been FreeBSD, I plan to walk further on this path with ZFS.

The ZFS was developed by Sun™ that uses a pooled storage method. There's really a lot of features that makes this file system the most advanced file system. But unfortunately, I don't really understand them that much. So as of this current writing, below are the things I do understand, and how I understand it (corrections are VERY welcome).

  • Redundancy - still is available when something bad happens
  • Mirroring - much like using RAID1 on ZFS or having a hard disk/s with an exact copy to another disk and keeping the process running eventhough 1 or more (but not all) disk fails.
  • Snapshots - Keeping a state of the hard disk at a given time.
  • Rollback - A recovery process from a Snapshot.

FreeBSD 7.1 CONFIGURATION AND TUNING FOR ZFS


I used an AMD Phenom Quad-Core Processor with 2GB of memory b0x under FreeBSD 7.1 AMD64. I started on reading from the FBSD Handbook (http://www.freebsd.org/doc/en/books/handbook/filesystems-zfs.html). I also used this reference to modify my b0x http://wiki.freebsd.org/ZFSTuningGuide.

I started having this configuration added to my FBSD b0x by editing the /boot/loader.conf

vm.kmem_size_max="1024"
vm.kmem_size="1024"

vfs.zfs.arc_max="100M"

I also added a line to my rc.conf file by typing:

Then, I restarted my b0x and unfortunately, the result was a kernel panic :(

Afterwhich, I chose Escape to loader prompt from the FBSD boot menu and used unset to remove the above variables (ex. unset vm.kmem_size_max) and executed boot.

I started reviewing my configuration and realized that the reason for the panic was simply me being stupid. I forgot to put "M" to specify the file size. And so I edited the /boot/loader.conf file and put the values below:

vm.kmem_size_max="1024M"
vm.kmem_size="1024M"

vfs.zfs.arc_max="100M"

I rebooted my b0x and typed in

# zpool list
no pools available

Yeah! It seems to be working just fine now.


Edit: I ended up with the config below for my server

zfs_load="YES"
vfs.root.mountfrom="zfs:zfbsd/root"

vm.kmem_size_max="1024M"
vm.kmem_size="1024M"
vfs.zfs.zil_disable=1
vfs.zfs.arc_max="100M"
vfs.zfs.vdev.cache.size="5M"


"Now what?"


Thursday, March 12, 2009

Got My Microsoft Certs!

I just got my Microsoft Certifiactions via Fedex courier! Well, I was hoping this would arrive at earlier date but well, its just the same. I feel great!

The certifications I got was MCTS (Microsoft Certified Technology Specialist). The specific technology is on Windows Vista, Configuration. Well some of you may raise your eyebrows on this most specially the people who've known me well because most people know that I am a UNIX lover!

I took the exam last January 19, 2009. I barely passed this exam and perhaps the result is just a fluke. I'm not really looking forward to becoming a Microsoft Expert but hey, I'm in the IT field and knowing more does not make me less.

"Now What?"