czwartek, 15 maja 2008

beadm

In my last post I wrote a short howto to handmade zfs rpool cloning. It takes only a few steps, but forgetting one of them may provide wrong results. But OpenSolaris has one nice tool to do it all for you:

beadm create opensolaris-2

Simply do it, and your system will be cloned, your grub will have a new entry and the new filesystem's /etc/vfstab will have it's '/' entry corrected.
Now, why not do a clone every few days, just in case you ever remove your '/etc'?

wtorek, 13 maja 2008

Playing with fire

Following losely Indiana update guidelines found here I have done a clone of my root filesystem. Then I have fooled around with it a little bit.

zfs snapshot rpool/ROOT/opensolairs@for-cloning
zfs clone rpool/ROOT/opensolaris@for-cloning rpool/ROOT/opensolaris-1
zfs set mountpoint=legacy rpool/ROOT/opensolaris-1
mount -F zfs rpool/ROOT/opensolaris-1 /mnt
vim /mnt/etc/vfstab

Here I have replaced rpool/ROOT/opensolaris with rpool/ROOT/opensolaris-1. I yet edited /rpool/boot/grub/menu.lst by copying an OpenSolaris entry and changing the bootfs rpool/ROOT/opensolaris line in the copy to bootfs rpool/ROOT/opensolaris-1. In the end I had two different entries in grub boot menu.
I then did:

rm -rf /platform/

and rebooted. In the above one line I have effectively wiped out kernel and boot_archive. It came as no surprise, that grub complained that it couldn't boot my old system. Oh well, I choose the second entry, booted from the clone, promoted it with zfs promote, destroyed the old system, which became the clone now, and type to you quite happily from working OpenSolaris 2008.05.
Have a Nice day.

piątek, 9 maja 2008

ZFS snapshots

I started to like them. I became accustomed to create a snapshot of my filesystems periodically, just as I click Save button in Editors. Really nice feature, which makes my life easier. Undelete is almost obsolete. :)
For interested:


-bash-3.2# cat /usr/bin/zfs_snapshot.sh
#!/bin/sh

zfs snapshot -r rpool@`date +%Y-%m-%d:-:%H:%M`



-bash-3.2# time zfs_snapshot.sh

real 0m1.257s
user 0m0.014s
sys 0m0.023s

-bash-3.2# zfs list
NAME USED AVAIL REFER MOUNTPOINT
rpool 21,2G 67,9G 56,5K /rpool
rpool/ROOT 5,94G 67,9G 18K /rpool/ROOT
rpool/ROOT/opensolaris-1 5,94G 67,9G 5,28G legacy
rpool/ROOT/opensolaris-1@2008-05-09:-:22:59 0 - 5,28G -
rpool/ROOT/opensolaris-1/opt 673M 67,9G 673M /opt
rpool/ROOT/opensolaris-1/opt@2008-05-09:-:22:59 0 - 673M -
rpool/export 15,2G 67,9G 19K /export
rpool/export/home 15,2G 67,9G 15,2G /export/home
rpool/export/home@2008-05-09:-:22:59 70,5K - 15,2G -

środa, 19 marca 2008

prstat

I wrote about it in my Polish blog, but have seen it a few times since then on English channels that I decided to post it here also.
A person at #opensolaris channel had a problem, that


prstat -m | nawk '{print $10}' | nawk '{sum+=$1;} END {print sum;}'


just happily sat there printing nothing. It helps to know, that prstat, as the last arguments, takes interval between measurements and a count of measurements. If the count is omitted, prstat will take measurements waiting for ^C, thus the END will never be satisfied.
The version below works, taking one measurement and then printing the output.

prstat -m 1 1 | nawk '{print $10}' | nawk '{sum+=$1;} END {print sum;}'

One more thing worth knowing is that prstat, similarly to other tools, as a first measurement prints averages since system boot. Next measurements are closer to the actual state of system.