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


No comments:

Post a Comment