Archive for 2008年十一月月

directory-based quota

十一月 27, 2008

The other day I got the requirement to setup this directory-based quotation, after digging around for a while, I noticed that it looks not easy to achieve.  The native solaris is mean to setup quota based on file system.  without the support from the kernal, we have to look for another workarounds.

Say you got file sytem /export/test,  and you want to limit /export/test/a1 and /export/test/a2 to 100M and 200M respectively.  the workaround is to use loopback devices.

mkfile 100M /export/test/a1_f

mkfile 200M /export/test/a2_f

lofiadm -a /export/test/a1_f

lofiadm -a /export/test/a2_f

newfs /dev/rlofi/1

newfs /dev/rlofi/2

mount /dev/lofi/1 /export/test/a1

mount /dev/lofi/2 /export/test/a2

tip-to hide device temporarily on solaris platform

十一月 17, 2008

very occassionally, you might need to disable the physical device to test something and you also wanna it cannot be probed when solaris is up running.   Here we go for it

1. under openboop, run delete-device like below

{0} ok ” /pci@7c0/pci@0/pci@1/pci@0,2/QLGC,qla@1” $delete-device drop

pls note the space under first double-quot

 

2. do a reconfiguration boot “boot -r”

Then from Solaris level, you will not be able to see this HBA again.

回到家里

十一月 16, 2008

从公司回到家里。因为后台系统周末做升级,虽然这次不是我主刀,但是on-call,太多电话了,一会一个。索性跑到楼下客厅,专心上网,一边解case,一边看电影。

the peacemaker:  影片讲述俄国偷盗核弹头,最后经由恐怖分子带到纽约。影片本身没什么新意,我是奔着主演Nicole Kidman来的,解决并没觉得太漂亮。倒是里面的头号反派内心刻画的比较细腻,能够真切的感受他所遭受的痛苦。推介指数2星。

traitor:  这部影片我个人还是非常推介,讲述关于宗教,反恐等活动。情节紧张刺激,关于宗教也值得人深思,个人感觉推介指数5星。

a very bad on-call weekend

十一月 16, 2008

I was on-call this weekend and I had to say this is really tough. I kept being called by helpdesk, by getronics and by unix team.  I had to explain again and again that this is per normal, this is per change and blah,blah.

At the meantime, I also did some upgrades, which took me ages to track down issues with some SMFs failed to start.  But no matter how tedious and how diffcult it is, I made it finally.

This is work for life and live for work.

tip2-从solaris修改obp中的devalias

十一月 14, 2008

通过eeprom命令可以修改obp中的devalias设置:

可以参照例子

eeprom “nvramrc=devalias disk /sbus@2,0/QLGC,isp@1,10000/sd@0,0 devalias vx-bkroot /sbus@2,0/QLGC,isp@2,10000/sd@0,0″ 

eeprom “use-nvramrc?=true”

由于设置的devalias存在于nvram,必须重新加载open boot,来确保devalias生效。

分享小窍门–solaris live install

十一月 13, 2008

决定最近开始,陆续把自己整理的一些技术tip记录下来,一是可以与人分享,同时也方便自己查询。

第一个是solaris live install. 

(这篇文章我也发布在了chinaunix, 参见 http://bbs.chinaunix.net/viewthread.php?tid=1234970&highlight=shyjack)

solaris fresh install, 正常情况下需要shutdown原有系统,整个安装过程,原系统不可用。而live upgrade 又针对的是升级,不是fresh install, 经过几天的摸索,总结了一下 live install 的过程:

我的测试环境是在 solaris 11/06, 硬件为 Sun Fire V120 情况下做的测试, 这些步骤自己摸索,不要在生产系统上尝试。

1 将solaris 10 dvd spool到本地硬盘,该步骤可选,我习惯spool到本地硬盘,再做个tar包,哪台机器需要就传过去,可以做 live upgrade, 也可以boot server,很方便
  cd /cdrom/cdrom0/Solaris10/Tools/
  ./setup_install_server /sol10_image

注:v120上没有dvd,我的/sol10_image 实际就是从其他机器上拷贝过来的。

2 创建一个profile,准备live install用,我的测试机器上有两块硬盘c1t0d0 &c1t1d0,c1t0d0 上运行着sol10, c1t1d0 暂时没用,准备 live install一个sol10到c1t1d0,下面是一个profile的例子
install_type    initial_install 
system_type     standalone 
partitioning    explicit 
filesys         c1t1d0s0  15000 / 
filesys         c1t1d0s1  5000  swap 
filesys         c1t1d0s3  5000  /opt 
filesys         c1t1d0s4  5000  /var 
filesys         c1t1d0s5  free  /export 
cluster         SUNWCXall 

3 从sol10 image中拷贝出 transfer_list 文件
  cp /sol10_image/Solaris_10/Tools/Boot/etc/transfer_list  /etc 

4 用pfinstall进行live install
/usr/sbin/install.d/pfinstall -c /sol10_image /var/tmp/profile.c1t1

注:pfinstall本来是用来测试profile的,但是不指定-d 或者-D, pfinstall会直接往硬盘上安装

5 pfinstall会在硬盘 c1t1d0上建好vtoc,之后开始安装,安装完毕会报几个错误,但是只要所有的pkg都正常安装就无所谓。下面将手工修复这些错误

在pfinstall进行安装过程中,c1t1d0的上slice会被mount到 /a , 因此下面的一些手工修复也都是针对 /a (将 /a视为新os的root 目录) 

5.1  在pfinstall完毕,会在/tmp下创建 vfstab 和install log
    cp /tmp/vfstab /a/etc/vfstab
    cp /tmp/install_log /a/var/sadm/system/logs/install_log  (可选)

5.2  安装 boot block
    installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c1t1d0s0 

5.3  清理设备文件
    devfsadm -r /a -C
      devfsadm -r /a

5.4  在新os的/etc目录下创建 sysidcfg 文件,否则 system identification 过程也是很无聊 (可选)
     在 /a/etc 下创建 sysidcfg, 下面是一个例子

language=AU-English
network_interface=eri1 {primary
                         protocol_ipv6=no
                         netmask=255.255.255.0
                         default_route=none
                         hostname=testhost}
security_policy=none
nfs4_domain=dynamic
name_service=none
timezone=Australia/NSW
system_locale=en_AU
terminal=vt100
timeserver=localhost
root_password=4seRWaJMeSjTg

5.5  init 0 将机器带到 ok prompt, 用 c1t1d0s0 引导 os  

(由于pfinstall在修改boot-device时候失败,如果以后默认想用c1t1d0 引导系统,可以在这一步修改boot-device)

在整个测试过程中只遇到一个问题,就是系统运行在 c1t0d0 上的时候,第二块硬盘为 c1t1d0,  可是live install完后,用第二块硬盘启动的时候两块硬盘被probe成c0t0d0 &c0t1d0了, controller number不一致,需要手工修改下 /etc/vfstab 。

如何卸载solaris 10 05/08 自带的postgresql 8.1 & 8.2

十一月 13, 2008

因为需要,需要卸载sol10 05/08自带的postgresql 8.1 & 8.2, 没找到什么好的方法,通过pkginfo | grep -i post 可以看到好多与postgresql有关的package,但是不是很确定是否需要全部删除他们,碰巧在opensolaris 发现了这个工具,Solaris Package Companion (http://opensolaris.org/os/project/svr4_packaging/package_companion/).

它可以方便的将package cluster, package metacluster 整理出来,据此,可以明确的知道下面的package就是我要删除的。

   [C] SUNWCpostgr

      [P] SUNWpostgr

      [P] SUNWpostgr-contrib

      [P] SUNWpostgr-docs

      [P] SUNWpostgr-jdbc

      [P] SUNWpostgr-libs

      [P] SUNWpostgr-server-data

      [P] SUNWpostgr-server

      [P] SUNWpostgr-tcl

 

   [C] SUNWCpostgr-dev

      [P] SUNWpostgr-devel

      [P] SUNWpostgr-pl

 

   [C] SUNWCpostgr-82

      [P] SUNWpostgr-82-client

      [P] SUNWpostgr-82-contrib

      [P] SUNWpostgr-82-docs

      [P] SUNWpostgr-82-jdbc

      [P] SUNWpostgr-82-libs

      [P] SUNWpostgr-82-server

      [P] SUNWpostgr-82-server-data-root

      [P] SUNWpostgr-82-tcl

 

   [C] SUNWCpostgr-82-dev

      [P] SUNWpostgr-82-devel

      [P] SUNWpostgr-82-pl

升级系统

十一月 12, 2008

已经快午夜了,还在做这个系统升级,本来不想干的,不过帮同事的忙,没办法,好在有pay,就当挣钱了。

升级过程本身很简单,将sol10 11/06 升级到 05/08, 采用live upgrade, 过程比较straightforward, 没什么特别的。倒是etrust Access Control 升级值得提一下。

早期的eAC load kernel module 的时候,需要一个syscall, 而且要写入/etc/name_to_sysnum, 但是明显eAC有个bug,就是它会在177-256之间随机招一个空闲的值,写入该文件,但是实际最大有效值只有255, 因此当177-255都被占用的情况下(unfortunately 05/08就是这种情况), eAC 会写入256, 这样将直接导致系统不可引导。 几个月前,我和CA开了case,解决办法是升级到eAC v8 CR12, 据说该版本syscall interface is no longer being used , 但是升级之后发现,eAC其实是在101-256之间寻找了,而且CA是咨询过SUN得知101,102 在sol10中不会使用,的确eAC v8CR12可以暂时解决问题,但是保不准将来sun哪天就把101,102也用了,看你eAC怎么办?

旧车换新车

十一月 11, 2008

终于卖掉了这辆camry。它跟随我快2年,伴随我悉尼的近2年生活,就像一个忠诚的老马,辛苦不计报酬,还记得装修的时候,一次装了900斤,一次装了1600斤的瓷砖,从canterbury 摇摇晃晃的载到marsfield,差点累趴下。

2张图片做记录

camry1

camry2

这是新买的m3 neo sports.  自动波,2.0L, 最让我感兴趣的就说它还有手动模式。

img_0988