FreeNAS with MegaRAID SAS 9240-8i

Recently I’ve been involved in a small project to add a support for MegaRAID SAS 9240-8i into FreeNAS 0.71. To tell the truth it was fun since I haven’t been tinkering FreeBSD for quite a long time. Anyway, if you need a support for this card in your FreeNAS installation just download and unpack the kernel from here.

Permanent memory’s riddle

Several days ago I noticed that something wrong was happening with the way cfgadm reported the size of the permanent memory. On a partitioned SunFire 6900 iron with two SBs (SB0 and SB2) in a domain the output looks the following:

cfgadm -alv | grep perm
N0.SB0::memory connected configured ok base address 0x0, 33554432 KBytes total, 33403472 KBytes permanent

I don’t believe in coincidences and the fact that permanent memory was equal to the size of one SB’s memory had raised an eyebrow.

# prtconf | grep Mem
Memory size: 65536 Megabytes

We all know that a permanent memory is Kernel plus OpenBoot and if cfgadm was correct then it’s an easy deal to check that with mdb but…

# echo "::memstat" | mdb -k
Page Summary                Pages                MB  %Tot
------------     ----------------  ----------------  ----
Kernel                     129720              1013    2%
Anon                      1357367             10604   16%
Exec and libs               30298               236    0%
Page cache                 278509              2175    3%
Free (cachelist)          1858089             14516   23%
Free (freelist)           4581704             35794   56%

Total                     8235687             64341
Physical                  8226460             64269

There is an Oracle Standby running inside this domain and the output of “ipcs -ma”, as expected, almost exactly matches with ‘Anon’ section from the aforementioned mdb’s output and when the standby is stopped anonymous memory reduces proportionally. But why on the earth cfgadm produces such an outrageous report?! Reboot doesn’t help and the system is fully patched using, yes a bit outdated, EIS DVD from the 30th of March 2010.

# uname -a
SunOS sf6900-2-da 5.10 Generic_142900-07 sun4u sparc SUNW,Sun-Fire

So far, the answer to this puzzle is yet to be found but if you have a solution on your hands than please give me a hint. ;-)

P.S. This system doesn’t have a support contract so opening a ticket on the sunsolve is not an option.

Mirroring root disk on HP-UX 11iv3

This post have been resting in a dust a way too long but now I’m going to fix that by guiding you through a very important and sometimes a vital process as a root disk mirroring on HP-UX. Truth to be told that there is no single grain of rocket science so treat it as a pure reference. Lets imagine that disk3 is a current boot device and disk5 will be our new mirror.

  1. Run the following commands to determine the size (in megabytes) of EFI, HP-UX and HSPS of the boot device:
  2. # diskinfo -b /dev/rdisk/disk3_p1 | awk '{print $1/1024}'
    # diskinfo -b /dev/rdisk/disk3_p2 | awk '{print $1/1024}' 
    # diskinfo -b /dev/rdisk/disk3_p3 | awk '{print $1/1024}'
  3. Next, prepare a file, i.e. /tmp/partitionfile, with the following content:
  4. 3
    EFI 500MB
    HPUX 100%
    HPSP 400MB
  5. It’s quite convenient to have a list of disks before making the changes so once they’re applied they will be vividly visible at once:
  6. # ioscan -fnC disk
    # ioscan -m dsf
  7. Create the partitions on a new disk and with insf command make them available to OS by creating the device files:
    # idisk -f /tmp/partitionfile -w /dev/rdisk/disk5
    # insf -e 
  8. Make it bootable:
  9. # pvcreate -f -B /dev/rdisk/disk5_p2 
  10. Extend the root volume group:
  11. # vgextend vg00 /dev/disk/disk5_p2 
    Volume group "vg00" has been successfully extended.
    Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
  12. To complete the setup of the disk as a boot disk run mkboot command:
  13. # mkboot -e -l /dev/disk/disk5

    The -e option tells mkboot to use EFI layout and the -l option tells mkboot that this volume will be used by a volume manager (even if it is not currently used by one)

  14. Create a temporary AUTO file and use the efi_cp command to copy it to the mirror, using the block device of the first (EFI) partition. The –lq option ensures that the system will boot without quorum. In the event of the primary boot disk failing this will allow the mirror disk to boot.
  15. # print 'boot vmunix -lq' > /tmp/AUTO
    # efi_cp -d /dev/disk/disk5_p1 /tmp/AUTO EFI/HPUX/AUTO
  16. Now proceed with mirroring your logical volumes. I used pvdisplay to get an ordered list of the volumes to be able to create the mirrored volumes in the same order.
  17. # pvdisplay -v /dev/disk/disk3_p2 | grep "current.*00000"
    # /usr/sbin/lvextend -m 1 /dev/vg00/lvol1 /dev/disk/disk5_p2
    # /usr/sbin/lvextend -m 1 /dev/vg00/lvol2 /dev/disk/disk5_p2
    # /usr/sbin/lvextend -m 1 /dev/vg00/lvol3 /dev/disk/disk5_p2
    # /usr/sbin/lvextend -m 1 /dev/vg00/lvol4 /dev/disk/disk5_p2
    # /usr/sbin/lvextend -m 1 /dev/vg00/lvol5 /dev/disk/disk5_p2
  18. Prepare LVM logical volume to be root, boot, primary swap, or dump volume:
  19. # /usr/sbin/lvlnboot -b /dev/vg00/lvol1
    # /usr/sbin/lvlnboot -r /dev/vg00/lvol3
    # /usr/sbin/lvlnboot -s /dev/vg00/lvol2
    # /usr/sbin/lvlnboot -d /dev/vg00/lvol2
    # /usr/sbin/lvlnboot –R
  20. Finally, add the new disk to boot device configuration table:
  21. # /usr/bin/echo “l /dev/disk/disk5_p2” >> /stand/bootconf
  22. Set the alternate boot path to the mirror_disk:
  23. # /usr/sbin/setboot -a /dev/disk/disk5_p2
  24. If the mirror disk includes an HPSP partition, use the efi_fsinit command on the character device file for the HPSP (third) partition to initialize it with an EFI file system:
  25. # /usr/sbin/efi_fsinit -d /dev/rdisk/disk5_p3

What a day!

Today was one of those strange days when everything is changing so quickly that it’s simply impossible to grasp a single moment of your life. Sometime I wish I had a pause button somewhere to fix that. Oddities. During the day I was using a subway quite extensively and every time I entered a car there was a homeless reeking so hard and badly making an impression that a tear-gas grenade had just exploded. Lesson learned. If you think you know everything my advise just go through a job interview to make this illusion to dissolve. The advantage of this is that the skills and knowledge that have been buried deeply inside your mind could be revived quickly in a flash. Too bad for you, if you like me, could remember a right answer one hour after the interview and when it’s too late. There no such thing as a rewind button and the time machine is yet to be invented, so just try to be more collected the next time.

Good luck, my friend.