Wednesday, February 4, 2009

Adding ZFS swap to EON

Adding a ZFS swap, sized to your liking with EON is easy once you have built a zpool. This is very HIGHLY recommended for performance reasons. Doing so will also make it possible to run update image (updimg.sh) on systems that do not have enough memory(systems that freeze in the midst of updimg.sh). A good size for starters are 1.0X, 1.5X and 2.0X RAM. After your zpool is built, simply do
zfs create -V 1G pool/swap
This will build a 1G swap(in this case it's named swap, but could be named to your preference). Then simply add the following to /mnt/eon0/.exec to auto mount at boot
/usr/sbin/swap -a /dev/zvol/dsk/pool/swap
Optional: You can also add it to /etc/vfstab but this would require running updimg.sh to preserve the changes.
echo "/dev/zvol/dsk/pool/swap - - swap - no -" >> /etc/vfstab
Please note the flexibility here. Let's say you need 2Gb of swap instead of the previous 1Gb. Simply:
swap -d /dev/zvol/dsk/pool/swap
zfs destroy pool/swap
zfs create -V 2G pool/swap
swap -a /dev/zvol/dsk/pool/swap
Your new, improved and resized swap is ready!

5 comments:

big bad wolf said...

Nice little tutorial.
One thing to point out.
Not zpool but zfs.

zfs create -V 1G pool/swap

Andre said...

Thanks big bad wolf

Ahmet Muhtar said...

Great product...
Well, no zpool or zfs command available in EON shell. Is there a way to use zfs through Webadmin?

Cheers

Andre said...

Ahmet,

zpool, zfs available for user id root after logging in as admin simply su and give the root credentials.

or as admin
pfexec /usr/sbin/zpool ...
pfexec /usr/sbin/zfs ...

Cedric Tineo said...

Is this still recommended with the latest version of Eon?

For all systems or only those with less than X GB of RAM? And what would be X?