Monday, April 7, 2008

ZFS, Sekedar Catatan Kecil

Sekedar catatan ketika mencoba ZFS di Solaris Express 5.11 di vmware, mudah-mudahan bermanfaat, amien… :)

Create mirror pool dengan nama “bigpool”

# zpool create bigpool mirror c0d1 c1d1

Check partisi apakah benar menggunakan ZFS filesystem

# fstyp /dev/dsk/c0d1s0
zfs

List ZFS yang ada

# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
bigpool 3.97G 898K 3.97G 0% ONLINE -

Mengaktifkan fitur compression di pool

# zfs set compression=on bigpool

Create home direktori filesystem dan di mount ke /export/home

# zfs create bigpool/home
# zfs set mountpoint=/export/home bigpool/home

Mengaktifkan NFS-export secara Otomatis disemua home direktori

# zfs set sharenfs=rw bigpool/home

Create home direktory untuk masing-masing user

# zfs create bigpool/home/arya
# zfs create bigpool/home/dhani
# zfs create bigpool/home/manda

List ZFS yang ada sekarang :

zfs1.jpg

Setting quota masing-masing user

# zfs set quota=300m bigpool/home/arya
# zfs set quota=200m bigpool/home/dhani
# zfs set quota=100m bigpool/home/manda

List ZFS yang ada sekarang dengan quota yang telah diset sebelumnya

zfs2.jpg

Menambah quota masing-masing user (fitur ini sangat terasa mudah sekali dibandingkan jika kita extend partisi di filesystem lain)

# zfs set quota=150m bigpool/home/manda
# zfs set quota=210m bigpool/home/dhani

List ZFS yang ada, dengan quota yang telah di extend

zfs3.jpg

Untuk menambah space ke pool

# zpool add bigpool mirror c2d1 c2d2

Membuat snapshot direktori arya

# zfs snapshot bigpool/home/arya@today

Mengembalikan snapshot ke snapshot sebelumnya

# zfs rollback bigpool/home/arya@yesterday

Jika ingin mencoba Administrasi ZFS via GUI bisa juga dengan menjalankan service “smcwebserver”

# /usr/sbin/smcwebserver start

Kemudian arahkan web browser ke https://nama_host:6789

Ini adalah screenshoot dari ZFS GUI :

ZFS GUI_1 zfs_gui.jpg

Friday, March 14, 2008

Reset password Alom mesin SUN from Operating System Solaris

Install RSC package dari EIS-DVD:

# cd cdrom/cdrom0/sun/progs/RSC/2.2.3/
# mkdir /tmp/RSC
# unzip -d /tmp/RSC rsc2.2.3_pakages_s9.zip
# cd /tmp/RSC/
# pkgadd -d .
Pilih paket no 25,26 dan 27, dan jawab semua pertanyaan yang ada di wizard.
Check Pakages
# pkginfo |grep SUNWrsc
# /usr/platform/SUNW,Sun-Fire-xxx/rsc/rscadm userpassword admin
password : ********
Re-type password : ********
Show network configuration
# /usr/platform/SUNW,Sun-Fire-xxx/rsc/rscadm shownetwork
Setting IP dan gateway
# /usr/platform/SUNW,Sun-Fire-xxx/sbin/scadm set netsc_ipaddr ...
# /usr/platform/SUNW,Sun-Fire-xxx/sbin/scadm set netsc_ipnetmask ...
# /usr/platform/SUNW,Sun-Fire-xxx/sbin/scadm set ipgateway ...
Simpan konfiguras setelah melakukan perubahan
# /usr/platform/SUNW,Sun-Fire-xxx/rsc/rscadm resetsc
NB : Setiap melakukan perubahan settingan di Alom, maka dibutuhkan resetsc untuk menyimpan hasil perubahan tersebut

Howto Install and Using RSC (Remote System Control)

RSC (Remote System Control) berfungsi untuk melakukan remote ke ALOM dalam sebuah machine SUN.

Untuk installasinya bisa mengikuti step-step dibawah ini:

# cd cdrom/cdrom0/sun/progs/RSC/2.2.3/
# mkdir /tmp/RSC
# unzip -d /tmp/RSC rsc2.2.3_pakages_s9.zip
# cd /tmp/RSC/
# pkgadd -d .
Pilih paket no 25,26 dan 27, dan jawab semua pertanyaan yang ada di wizard.
Check Pakages
# pkginfo |grep SUNWrsc
Jika kita ingin mengakses RSC ini lewat GUI, maka kita bisa melakukan langkah-langkah ini:

Export DISPLAY server anda ke komputer remote
# export DISPLAY=ip_komp_remote:0.0
Aktifkan xmanager passive, kemudian jalankan command dibawah ini:
# cd /opt/rsc/bin
# ./rsc &
jika tidak ada error message, maka tampilan GUI dari Remote System Control ini akan tampil di layar komputer remote.


Wednesday, March 5, 2008

Install & Configure pkg_get Solaris 10

Ini adalah dokumentasi cara menginstall dan mengkonfigurasi "pkg_get" di Solaris 10, dengan pkg_get ini proses instalasi suatu paket akan dijalankan secara online ke server repository yang tersedia, jadi install software akan menjadi semudah "apt-get" di debian base dan "yum" di redhat base, menyenangkan bukan? :)

Download pkg_get.pkg

# /usr/sfw/bin/wget http://www.blastwave.org/pkg_get.pkg
Install pkg_get.pkg (full path)
# pkgadd -d /pkg_get.pkg

The following packages are available:
1 CSWpkgget pkg_get - CSW version of automated package download tool
(all) 3.8.4

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: 1
Sampai disini akan ditanyakan apakah kita akan membuat directory /opt/csw, dimana directory ini akan dipergunakan untuk menyimpan semua paket instalasi yang dilakukan via pkg_get.
Do you want this directory created now [y,n,?,q] y
Proses instalasi dimulai
## Installing part 1 of 1.
/opt/csw/bin/pkg-get
/opt/csw/etc/pkg-get.conf.csw
/opt/csw/share/man/man1m/pkg-get.1m
/var/pkg-get/admin-fullauto
[ verifying class ]
## Executing postinstall script.
Pastikan pesan success muncul di akhir proses instalasi ini
Installation of was successful.
Langkah-langkah diatas bisa dipersingkat dengan menggunakan command :
# pkgadd -d http://www.blastwave.org/pkg_get.pkg
Import PGP public key
# /usr/sfw/bin/wget --output-document=pgp.key http://www.blastwave.org/mirrors.html
# gpg --import pgp.key
Untuk memudahkan menggunakan command pkg_get ini kita buat symlink dari file pkg_get yang ada di /opt/csw/bin ke /usr/sbin, jadi jika kita mau menggunakan command pkg_get tidak harus mengetikkan command tersebut secara full path.
# ln -s /opt/csw/bin/pkg-get /usr/sbin
Perlu diingat, bahwa configurasi pkg_get ini ada di "/opt/csw/etc/pkg-get.conf", jadi jika kita ingin meng-edit configurasi pkg_get ini silahkan edit file tersebut, misal kita ingin mengubah alamat repository dll.

Untuk menginstall program secara online menggunakan pkg_get ini, bisa menggunakan command :
# pkg-get -i nama_program
misalkan jika kita ingin menginstall seamonkey
# pkg-get -i seamonkey
Untuk mengupdate katalog file, bisa gunakan command :
# pkg-get -U

Referensi : http://www.blastwave.org/howto.html

Tuesday, March 4, 2008

Hint JumpStart Solaris 10

  1. Package add the JET framework and other modules you require on to the prospective JumpStart server.
  2. # pkgadd -d SUNWjet.pkg JetEISCD JetSDS JetVXVM
  3. Add /opt/SUNWjet/bin to your PATH variable

  4. Edit /opt/SUNWjet/etc/jumpStart.conf

  5. Set up the Solaris media for the JumpStart
  6. # copy_solaris_media
    # add_solaris_location
  7. If you want an EIS CD build for the client, copy the eis-cd patches etc to the server
  8. # copy_eiscd
  9. Create a template for the client using
  10. # make_template client_name
  11. Edit the template in /opt/SUNWjet/Templates/client_name

  12. Set up the server to jumpStart the client using
  13. # make_client client_name
  14. JumpStart the client from "ok prompt"
ok > boot net - install - w

IPMP on Solaris 10

  • Setting IPMP with 2 physical ethernet using 3 IP Address
# more /etc/hosts
127.0.0.1 localhost
192.168.0.2 server1
192.168.0.3 server1-bge0
192.168.0.4 server1-bge1

# more /etc/netmasks
192.168.0.0 255.255.255.0
# more /etc/defaultrouter
192.168.0.1
# more /etc/hostname.bge0
server1 netmask + broadcast + group ipmp0 up \
addif server1-bge0 deprecated -failover netmask + broadcast + up
# more /etc/hostname.bge1
server1-bge1 deprecated -failover netmask + broadcast + group ipmp0 up
Now we have 3 IP address, 2 physical (192.168.0.3 & 192.168.0.4) and 1 virtual (192.168.0.2), if one of physical ip has disrupted, we still have 192.168.0.2 alive.
# reboot

  • Setting IPMP with 2 physical ethernet using 1 IP address
# more /etc/hosts
127.0.0.1 localhost
192.168.0.224 server1 loghost
# more /etc/hostname.bge0
server1 netmask + broadcast + group ipmp0 up
# more /etc/hostname.bge1
group ipmp0 up
# reboot

Metadb failed bootdisk error

Error :

Insufficient metadevice database replicas located, Use metadb to delete databases which are broken...

Solving :

  1. Check database metadb yg rusak (jika ada yg "unknown" berarti disitulah letak database metadb yang rusak).
  2. # metadb -i
  3. Delete database metadb yg rusak.
  4. # metadb -d -f /dev/rdsk/c0d1s7
  5. Restart machine.
  6. # reboot
  7. Copy VTOC dari disk0 ke disk1.
  8. # prtvtoc /dev/rdsk/c0d0s2 | fmthard -s - /dev/rdsk/c0d1s2
  9. Create metadb baru di disk yang metadb nya rusak.
  10. # metadb -a -c 3 -f /dev/dsk/c0d1s7
  11. Copy data dari disk0 ke disk1.
  12. # metareplace -e d0 c0d1s0
    # metareplace -e d1 c0d1s1
    # metareplace -e d3 c0d1s3
    # metareplace -e d4 c0d1s4
    # metareplace -e d5 c0d1s5
    # metareplace -e d6 c0d1s6
  13. Check status synchronize data dari disk0 ke disk1.
  14. # metastat -i

Dump all the file system with bourne shell

If want to dump an all the file system, we can use bourne shell at the prompt :

# sh
# for i in 0 1 3 4 5 6 (number partition)
# do
# ufsdump 0ucf 192.168.0.2:/dev/rmt/0n /dev/md/rdsk/d$i (mirror)
# echo $i done
# done
Note :
192.168.0.2 : Place of tape drive attached

Howto Unmirror a File System That Cannot Be Unmounted Solaris 10

Use this task to unmirror file systems, including root (/), /usr, /opt, and swap, that cannot be unmounted during normal system operation.

  1. Make sure that you have root privilege and that you have a current backup of all data.
  2. Verify that at least one submirror is in the Okay state.
  3. # metastat mirror
  4. Detach the submirror that will continue to be used for the file system.
  5. # metadetach mirror submirror
  6. Use one of the following commands, depending the file system you want to unmirror:

    • For the /usr, /opt, or swap file systems, change the file system entry in the /etc/vfstab file to use a non-Solaris Volume Manager device (slice).

    • For the root (/) file system only: run the metaroot command.
  7. # metaroot rootslice
  8. Reboot the system.
  9. # reboot
  10. Clear the remaining mirror and submirrors.
  11. # metaclear -r mirror

Example Unmirroring the root (/) File System
# metastat d0
d0: Mirror
Submirror 0: d10
State: Okay
Submirror 1: d20
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 40541184 blocks (19 GB)

d10: Submirror of d0
State: Okay
Size: 40541184 blocks (19 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t0d0s0 0 No Okay Yes

d20: Submirror of d0
State: Okay
Size: 40541184 blocks (19 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t1d0s0 0 No Okay Yes
# metadetach d0 d20
d0: submirror d20 is detached
# metaroot /dev/dsk/c0t0d0s0
# reboot
# metaclear -r d0
d0: Mirror is cleared
d10: Concat/Stripe is cleared
# metaclear d20
d20: Concat/Stripe is cleared

Example Unmirroring the swap File System
# metastat d1
d1: Mirror
Submirror 0: d11
State: Okay
Submirror 1: d21
State: Okay
# metadetach d1 d21
d1: submirror d21 is detached
Edit the /etc/vfstab file to change the entry for swap from metadevice to slice name
# vi /etc/vfstab
In this example, the /etc/vfstab file contains the following entry for the swap file system:
/dev/md/dsk/d1 - - swap - no -
Change the entry to read as follows:
/dev/dsk/c0t0d0s1 - - swap - no -
# reboot
# metaclear -r d1
d1: Mirror is cleared
d11: Concat/Stripe is cleared
# metaclear d21
d21: Concat/stripe is cleared

Monday, March 3, 2008

Howto Unmirror a File System that can be unmounted Solaris 10

Use this procedure to unmirror a file system that can be unmounted while the system is running.
To unmirror root (/), /var, /usr, or swap, or any other file system that cannot be unmounted while the system is running

  1. Make sure that you have root privilege and that you have a current backup of all data.
  2. Verify that at least one submirror is in the Okay state.
  3. # metastat mirror
  4. Unmount the file system.
  5. # umount /file-system
  6. Detach the submirror that will continue to be used for the file system.
  7. # metadetach mirror submirror
  8. Clear the mirror and remaining subcomponents.
  9. # metaclear -r mirror
  10. Edit the /etc/vfstab file to use the component detached in Step4 , if necessary.
  11. Remount the file system.
# mount /file-system

Example : Unmirroring the /opt File System

# metastat d3
d3: Mirror
Submirror 0: d13
State: Okay
Submirror 1: d23
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 31464192 blocks (15 GB)

d13: Submirror of d3
State: Okay
Size: 31464192 blocks (15 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t0d0s3 0 No Okay Yes

d23: Submirror of d3
State: Okay
Size: 31464192 blocks (15 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c0t1d0s3 0 No Okay Yes
# umount /opt
# metadetach d3 d13
d3: submirror d13 is detached
# metaclear -r d3
d3: Mirror is cleared
d23: Concat/Stripe is cleared
Edit the /etc/vfstab file so that the entry for /opt is changed from d3 to the underlying slice or volume
# mount /opt

Reset Password root Solaris 10

Sering sekali saya menemui kasus dimana seorang administrator lupa akan password root di salah satu mesin/server, mungkin dikarenakan banyaknya server/mesin yang mereka handle, walau sebenarnya hal ini tidak boleh terjadi :(

Nah dalam tulisan ini saya ingin mendokumentasikan howto tentang me-reset password root di mesin solaris 10

  1. Masuk ke OK prompt (bisa melalui halt, init 0 atau STOP + A)
  2. Booting ke cdrom dan masuk ke single user
  3. ok> boot cdrom -s
  4. Check slice root dengan command "fsck"
  5. # fsck -y /dev/rdsk/c0t0d0s0 (Letak slice root)
  6. Mount slice root ke /mnt (atau /a)
  7. # mount /dev/dsk/c0t0d0s0 /mnt
  8. Masuk ke direktori /etc
  9. # cd /mnt/etc
  10. Untuk kemudahan penggunaan terminal ada baiknya kita export terminal terlebih dahulu
  11. TERM=sun
    export TERM
  12. Edit /etc/shadow (letak password root yang telah di enkrip)
  13. # vi shadow
  14. Hapus password root yg telah di enkrip (di kolom kedua)
  15. ....
    root:(hapus):
    ....
  16. Masuk ke home directory root
  17. # cd
  18. Umount mounting slice root yang tadi di mount ke /mnt
  19. # umount /mnt
  20. Restart komputer (seharusnya nanti akan langsung masuk ke Solaris, tanpa ditanyakan password)
  21. # reboot
  22. Set ulang password root
  23. # passwd

Howto SUNWexplo Solaris 10

Download paket SUNWexplo di website sun atau bisa juga diinstall dari DVD Solaris nya.

Extract file SUNWexplo.tar.Z:

# zcat SUNWexplo.tar.Z | tar xvf -
Install paket SUNWexplo:
# pkgadd -d . SUNWexplo
Jalankan SUNWexplo untuk meng-collect data-data mesin yang terinstall Solaris.
# /opt/SUNWexplo/bin/explorer
Output dari aplikasi ini di simpan dalam direktori /opt/SUNWexplo/output/explorer.XXXX dimana XXXX ini adalah angka-angka yang menidentifikasikan serial number mesin dan nama hostname.

ACL - Solaris 10

Little documentation about ACL at Solaris 10 :)

(-) The following example shows you how to substitute an ACL on the file named file1. The ACL permissions are configured as follows:

  • The file owner has read, write, and execute permissions
  • The group has read and write permissions
  • The other users have read-only permissions
  • The user named user1 has read, write, and execute permissions on the file
  • The ACL mask has read and write permissions
  • The user named user1 has read, write, and execute permissions
Perform the setfacl command with the following options to substitute an ACL on file1:
# setfacl -s u::rwx,g::rw-,o:r--,m:rw-,u:user1:rwx file1
Or using this command :
# setfacl -s u::7,g::6,o:4,m:6,u:user1:7 file1
(-) Command copies the ACL entries from the file named file1 to the file named file2
# getfacl file1 | setfacl -f - file2

Sunday, March 2, 2008

Install driver emulex LP11000 di Solaris 10

Ini adalah step-step menginstall driver emulex LP110000 di Solaris 10, yang saya implementasikan di Sunfire 240 :)

1. Install Emulex Kit

# tar xvf emlxu_kit-1.00n-sparc.tar
# pkgadd -d .

The following packages are available:
1 EMLXemlxu ....
Pilih no. 1 kemudian ikutin step-step selanjutnya hingga selesai, dan pastikan muncul message "successfull", kemudian delete semua binding :
cd /opt/EMLXemlxu/bin/
./emlxdrv

Pilih "clear_all" kemudian pilih "q" untuk exit
# reboot
2. Install LPFC
# tar vxf lpfc-6.10g-sparc.tar
# pkgadd -d .

The following packages are available:
1 EMLXemlxu ....
2 lpfc.1 ....
Pilih no. 2 kemudian ikutin step-step selanjutnya hingga selesai, dan pastikan muncul message "successfull"
# reboot
3. Install HBAnyware
# tar vxf solaris-3.0a17-6.10g-1b.tar
# gunzip HBAnyware-3.0a17-sparc.tar.gz
# tar -xvf HBAnyware-3.0a17-sparc.tar
# ./unpack_apps
# pkgadd -d .

The following packages are available:
1 EMLXemlxu ....
2 HBAnyware ....
3 lpfc.1 ....
Pilih no 2

Ikutin step-step selanjutnya hingga selesai, dan pastikan muncul message "successfull"
# sync
# reboot
Tambahan :

Untuk mensetting agar driver ini menjadi module loadable :
# modload /kernel/drv/sparcv9/lpfc
Untuk mengecek apakah driver Emulex ini sudah benar-benar terinstall maka ada beberapa command yang bisa dipergunakan :
# modinfo | grep lpfc
41 1324460 57320 130 1 lpfc (Emulex FC SCSI/IP lpfc 6.10g)
# /usr/sbin/lpfc//lputil
....

Emulex Fibre Channel Host Adapters Detected: 1
Host Adapter 0 (lpfc0) is an LP11000-M4 (Ready Mode)

ket : angka 1 berarti ada satu HBA yang terinstall.
Untuk menjalankan aplikasi GUI HBAnyware bisa menggunakan command :
# /usr/sbin/hbanyware/hbanyware
Jika Anda menginstall driver emulex melalui remote console via ssh atau telnet, maka kita bisa menggunakan xmanager untuk menampilkan HBAnyware GUI, caranya:
  • Install Xmanager di komputer atau notebook Anda

  • Jalankan Xmanager-Passive

  • Export display komputer remote menggunakan command:
# export DISPLAY=ip_komputer_anda:0.0
# /usr/sbin/hbanyware/hbanyware &
Jika tidak ada error, maka akan tampil tampilan GUI HBAnyware ini di notebook/komputer Anda.

Congratulation..!!!

Mount / unmount iso image di Solaris menggunakan lofiadm


  • Mount
lofiadm -a /path/image.iso
mount -F hsfs /dev/lofi/1 /mnt
  • Unmount
umount /mnt
lofiadm -d /dev/lofi/1

Mirroring (RAID 1) Solaris 10

Mendokumentasikan cara konfigurasi mirroring (RAID 1) di Solaris 10

Langkah-langkahnya:


  1. Membuat salinan VTOC
    prtvtoc /dev/rdsk/c0d0s2 | fmthard -s - /dev/rdsk/c0d1s2
  2. Membuat metadb, Metadb ini adalah file database yang akan menampung semua data konfigurasi mirror yang dibuat, sekedar saran, jika Anda bermaksud membuat mirroring di kemudian hari pada mesin Solaris, maka sebaiknya siapakan partisi unused yang nantinya akan berguna untuk menampung semua data konfigurasi mirror yang akan dibuat.
    metadb –a –c 3 –f c0d0s7 c0d1s7
  3. Membuat virtual device dari setiap slice yang akan dimirror.
    Skenario:
    d0 - / mirror
    d10 - /dev/dsk/c0d0s0
    d20 - /dev/dsk/c0d1s0

    d1 - swap
    d11 - /dev/dsk/c0d0s1
    d21 - /dev/dsk/c0d1s1
    metainit -f d10 1 1 /dev/dsk/c0d0s0
    metainit -f d20 1 1 /dev/dsk/c0d1s0
    metainit d0 -m d10

    metainit -f d11 1 1 /dev/dsk/c0d0s1
    metainit -f d21 1 1 /dev/dsk/c0d1s1
    metainit d1 -m d11
  4. Membuat virtal device di harddisk kedua
    metattach d0 d20
    metattach d1 d21
  5. Memberitahu operating system bahwa root sistem sekarang berupa virtual device bukan slice harddisk lagi
    metaroot d0
  6. Rubah device swap ke /dev/md/dsk/d1
  7. dumpadm -d /dev/md/dsk/d1
  8. Edit /etc/vfstab

  9. Restart
    lockfs -fa
    init 6
Jalankan command "metastat -i" untuk melihat status syncronisasi nya :)

Referensi :
[1] http://tedytirta.com/2007/09/12/raid-1-di-solaris-10/
[2] http://www.tech-recipes.com/solaris_system_administration_tips225.html

Setting IP address Solaris


  1. Aktifkan ethernet interface
  2. # ifconfig pcn0 plumb
  3. Assign IP ke interface ethernet
  4. # ifconfig pcn0 192.168.0.10 netmask 255.255.255.0 broadcast 192.168.0.255
  5. Meng-online kan interface ethernet
  6. # ifconfig pcn0 up
  7. Edit /etc/hosts
  8. # vi /etc/hosts
    192.168.0.10 delta (nama komp)
  9. Edit /etc/hostname.xxx
  10. # vi /etc/hostname.pcn0
    delta
  11. Edit /etc/netmasks
  12. # vi /etc/netmasks
    192.168.0.10 255.255.255.0
  13. Setting Gateway
  14. # vi /etc/defaultrouter
    192.168.0.1