2015年1月21日 星期三

Solaris 11 Boot Environments 開機環境



root@solaris:~# beadm list
BE                                Active         Mountpoint     Space    Policy      Created
--                                   ------           ----------           -----          ------   -------
solaris                           -                  -                       446.12M  static         2014-09-05 01:21
solaris-backup-1           -                  -                       35.05M    static         2014-09-11 22:27
solaris11                       NR              /                       3.35G       static         2014-09-11 22:36
solaris11-backup-1       -                  -                       70.0K       static         2014-10-06 17:25

在Active這個欄位:
R:表示重新開機會啟動的環境
N:表示目前啟動的開機環境


EX1:變更下次開機環境,由solaris11變更為solaris

BE                                Active         Mountpoint     Space    Policy      Created
--                                   ------           ----------           -----          ------   -------
solaris                           R                 -                       446.12M  static         2014-09-05 01:21
solaris-backup-1           -                  -                       35.05M    static         2014-09-11 22:27
solaris11                       N                /                        3.35G       static         2014-09-11 22:36
solaris11-backup-1       -                  -                       70.0K       static         2014-10-06 17:25


EX3:新建一個開機環境,建立一個開機環境為fortest
root@solaris:~# beadm create fortest
root@solaris:~# beadm list
BE                                Active         Mountpoint     Space    Policy      Created
--                                   ------           ----------           -----          ------   -------
fortest                           -                  -                        72.0K      static 2015-01-22 17:11


solaris                           R                 -                       446.12M  static         2014-09-05 01:21
solaris-backup-1           -                  -                       35.05M    static         2014-09-11 22:27
solaris11                       N                /                        3.35G       static         2014-09-11 22:36
solaris11-backup-1       -                  -                       70.0K       static         2014-10-06 17:25

EX3:刪除一個開機環境,將solaris11-backup-1此開機環境刪除

root@solaris:~# beadm destroy solaris11-backup-1
Are you sure you want to destroy solaris11-backup-1?  This action cannot be undone(y/[n]): y


root@solaris:~# beadm list
BE                                Active         Mountpoint     Space    Policy      Created
--                                   ------           ----------           -----          ------   -------
fortest                           -                  -                        72.0K      static 2015-01-22 17:11

solaris                           R                 -                       446.12M  static         2014-09-05 01:21
solaris11                       N                /                        3.35G       static         2014-09-11 22:36
solaris11-backup-1       -                  -                       70.0K       static         2014-10-06 17:25

2015年1月14日 星期三

Solaris 壓力測試使用SUN VTS

# unzip p18688458_7018_SOLARIS64.zip
# cd VTS7.0ps18.2_sparc_singlesystem

# pkgadd -d .

The following packages are available:
  1  SUNWvts       SunVTS Framework
                   (sparc) 7.0,REV=2008.02.15.13.31
  2  SUNWvtsmn     SunVTS Man Pages
                   (sparc) 7.0,REV=2008.02.07.18.38
  3  SUNWvtsr      SunVTS Framework (Root)
                   (sparc) 7.0,REV=2008.02.07.18.38
  4  SUNWvtss      SunVTS Server and BUI
                   (sparc) 7.0,REV=2008.02.07.18.38
  5  SUNWvtsts     SunVTS Core Installation Tests
                   (sparc) 7.0,REV=2008.02.15.13.31

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: all

# cd /usr/sunvts/bin
# ./runvts
Testing in Online Stress Mode -low

# ./startsunvts






2015年1月13日 星期二

How to Reconfigure a Zone to Use a VNIC


How to Reconfigure a Zone to Use a VNIC

This procedure refers to the second zone in the virtual network. The zone already exists, but its current configuration prevents it from becoming a part of the virtual network. Specifically, the zone's IP type is a shared type and its current interface is net0. Both of these configurations must be changed.
  1. Become an administrator.
  2. Create the VNIC.
    global# dladm create-vnic [-v vid] -l datalink vnic
    where vid refers to the VLAN ID that you assign to the VNIC. Specify the VLAN ID only if you want to create the VNIC as a VLAN.
    Do not configure the VNIC's interface yet. You will perform this step later in this procedure.
  3. Change the zone's IP type from shared to exclusive.
    global# zonecfg -z zone
    zonecfg:zone1> set ip-type=exclusive
    zonecfg:zone1>
  4. Change the zone's interface to use a VNIC.
    zonecfg:zone1> remove net physical=NIC
    zonecfg:zone1> add net
    zonecfg:zone1:net> set physical=vnic
    zonecfg:zone1:net> end
    zonecfg:zone1>
  5. Verify and commit the changes you have implemented and then exit the zone.
    zonecfg:zone1 verify
    zonecfg:zone1> commit
    zonecfg:zone1> exit
    global#
  6. Reboot the zone.
    global# zoneadm -z zone reboot
  7. Log in to the zone.
    global# zlogin zone
  8. Configure the VNIC with a valid IP address.
    If you are assigning a static address to the VNIC, you would type the following:
    zone# ipadm create-addr -a address interface
    where address can use CIDR notation.
  9. From the global zone, add the address information to the /etc/hosts file.
Example 2-3 Reconfiguring a Zone Configuration to Use a VNIC
In this example, zone2 already exists as a shared zone. The zone also uses the primary interface of the system rather than a virtual link. You need to modify zone2 to use vnic2. To use vnic2zone2's IP type must first be changed to exclusive. Note that some of the output is truncated to focus on the relevant information that relates to virtual networks.

global# dladm create-vnic -l net0 vnic2

global# zonecfg -z zone2
zonecfg:zone1> set ip-type=exclusive
zonecfg:zone1> remove net physical=net0
zonecfg:zone1> add net
zonecfg:zone1:net> set physical=vnic2
zonecfg:zone1:net> end
zonecfg:zone1> verify
zonecfg:zone1> commit
zonecfg:zone1> exit
global# zoneadm -z zone2 reboot

global# zlogin zone2
zone2# ipadm create-ip vnic2
zone2# ipadm create-addr -a 192.168.3.85/24 vnic2
ipadm: vnic2/v4

zone2# exit

global# vi /etc/hosts
#
::1             localhost
127.0.0.1       localhost
192.168.3.70    loghost   #For net0
192.168.3.80    zone1   #using vnic1
192.168.3.85    zone2   #using vnic2

參考資料
https://docs.oracle.com/cd/E26502_01/html/E28992/ggiyq.html#gicom

2015年1月12日 星期一

ZFS snapshot & rollback 快照及還原


  • 建立整個rpool的快照

root@solaris:/# zfs list -t snapshot
NAME                                           USED  AVAIL  REFER  MOUNTPOINT
rpool/ROOT/solaris11@install                  7.14M      -  1.92G  -
rpool/ROOT/solaris11@2014-09-11-14:27:28      55.3M      -  2.06G  -
rpool/ROOT/solaris11@2014-09-11-14:36:12      55.3M      -  2.06G  -
rpool/ROOT/solaris11@2014-10-06-09:25:37      64.8M      -  2.07G  -
rpool/ROOT/solaris11/var@install              90.1M      -  96.7M  -
rpool/ROOT/solaris11/var@2014-09-11-14:27:28   614K      -  97.9M  -
rpool/ROOT/solaris11/var@2014-09-11-14:36:12   654K      -  98.0M  -
rpool/ROOT/solaris11/var@2014-10-06-09:25:37  61.4M      -   136M  -
root@solaris:/#


root@solaris:/# zfs snapshot -r rpool@2015-01-13
root@solaris:/# zfs list -t snapshot
NAME                                           USED  AVAIL  REFER  MOUNTPOINT
rpool@2015-01-13                                  0      -  4.58M  -
rpool/ROOT@2015-01-13                             0      -    31K  -
rpool/ROOT/solaris@2015-01-13                     0      -  2.29G  -
rpool/ROOT/solaris-backup-1@2015-01-13            0      -  2.06G  -
rpool/ROOT/solaris-backup-1/var@2015-01-13        0      -  98.1M  -
rpool/ROOT/solaris/var@2015-01-13                 0      -   102M  -
rpool/ROOT/solaris11@install                  7.14M      -  1.92G  -
rpool/ROOT/solaris11@2014-09-11-14:27:28      55.3M      -  2.06G  -
rpool/ROOT/solaris11@2014-09-11-14:36:12      55.3M      -  2.06G  -
rpool/ROOT/solaris11@2014-10-06-09:25:37      64.8M      -  2.07G  -
rpool/ROOT/solaris11@2015-01-13                   0      -  2.08G  -
rpool/ROOT/solaris11-backup-1@2015-01-13          0      -  2.07G  -
rpool/ROOT/solaris11-backup-1/var@2015-01-13      0      -   136M  -
rpool/ROOT/solaris11/var@install              90.1M      -  96.7M  -
rpool/ROOT/solaris11/var@2014-09-11-14:27:28   614K      -  97.9M  -
rpool/ROOT/solaris11/var@2014-09-11-14:36:12   654K      -  98.0M  -
rpool/ROOT/solaris11/var@2014-10-06-09:25:37  61.4M      -   136M  -
rpool/ROOT/solaris11/var@2015-01-13               0      -   101M  -
rpool/VARSHARE@2015-01-13                         0      -    88K  -
rpool/dump@2015-01-13                             0      -   768M  -
rpool/export@2015-01-13                           0      -   322M  -
rpool/export/home@2015-01-13                      0      -   730M  -
rpool/fs1@2015-01-13                              0      -    31K  -
rpool/swap@2015-01-13                             0      -  1.00G  -
root@solaris:/#


修改/etc/hosts檔,隨意加入一些字元
root@solaris:/# vi /etc/hosts
root@solaris:/# more /etc/hosts
#
# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# Internet host table
#
::1             localhost
127.0.0.1       solaris localhost loghost
192.168.1.110   client
10.10.10.10 test.cht.com.tw #instanceName
rollback test
rollback test
rollback test
rollback test
rollback test
rollback test
rollback test
rollback test
rollback test
rollback test
rollback test
rollback test
rollback test
root@solaris:/#
在/var/crash目錄touch 三個檔案做rollback測試使用
root@solaris:/var/crash# ls -al
total 9
drwx------   2 root     sys            5 Jan 13 18:41 .
drwxr-xr-x   8 root     root           8 Sep  5 01:30 ..
-rw-r--r--   1 root     root           0 Jan 13 18:41 123
-rw-r--r--   1 root     root           0 Jan 13 18:41 345
-rw-r--r--   1 root     root           0 Jan 13 18:41 789
root@solaris:/var/crash#

  • 還原snapshot
PS. 每個個別的子快照也必須還原

root@solaris:~# zfs rollback -r rpool/ROOT@2015-01-13
root@solaris:~# zfs rollback -r rpool/ROOT/solaris@2015-01-13
root@solaris:~#llback -r rpool/ROOT/solaris/var@2015-01-13
root@solaris:~# zfs rollback -r rpool/ROOT/solaris11@2015-01-13
root@solaris:~# zfs rollback -r rpool/ROOT/solaris11-backup-1@2015-01-13
root@solaris:~#  zfs rollback -r rpool/ROOT/solaris11-backup-1/var@2015-01-13
root@solaris:~# zfs rollback -r rpool/ROOT/solaris11/var@2015-01-13
root@solaris:~#  zfs rollback -r rpool/VARSHARE@2015-01-13

此時系統檔案會回復到snapshot快照當時的狀態

  • 刪除snapshot
root@solaris:~# zfs destroy -r rpool@2015-01-13

Oracle ALOM 系統登入

Oracle Integrated Lights Out Manager (Oracle ILOM)系統登入


Oracle 支援  Intelligent Platform Management Interface (IPMI),分為Serial connection串列埠,及
NetMgt網路管理埠;


  • Serial connection串列埠以CLI命令列管理界面登入:



login as: root                                                               (系統預設帳號為root,密碼changeme)
Using keyboard-interactive authentication.
Password:

Oracle(R) Integrated Lights Out Manager

Version 3.2.1.8.b r88893

Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.

Warning: password is set to factory default.

Hostname: ORACLESP-1136BDRE09

-> start /SYS                                                                           (開機)            
Are you sure you want to start /SYS (y/n)? y
Starting /SYS

-> start /sp/console                                                                  (開啟console畫面)
Are you sure you want to start /SP/console (y/n)? y

Serial console started.  To stop, type #.


  • 使用網路連線連接ILOM


設定固定IP給NetMgt
-> cd  /SP/network
->set   pendingipaddress = 192.168.2.199
->set   pendingipnetmask = 255.255.255.0
->set   pendingipgateway = 192.168.2.254
->set   pendingipdiscovery = static
->set   commitpending=true 

 設定好即可使用流覽器登入

2015年1月8日 星期四

Solaris Repository Update

Solaris Repository Update


# cp install-repo.txt install-repo.ksh
# chmod +x install-repo.ksh
# ./install-repo.ksh -d /repo -I -v -c

IPS repository exists at destination /repo
Current version: 0.175.1.0.0.24.2
Do you want to add to this repository? (y/n) y

Comparing checksums of downloaded files...done. Checksums match.

Uncompressing sol-11_2-repo-1of4.zip...done.
Uncompressing sol-11_2-repo-2of4.zip...done.
Uncompressing sol-11_2-repo-3of4.zip...done.
Uncompressing sol-11_2-repo-4of4.zip...done.
Repository can be found in /repo.
Initiating repository rebuild.
Initiating repository verification.
Scanning repository (this could take some time)                     0/6383         
 /
::略
pkg://solaris/group/prerequisite/oracle/oracle-rdbms-server-12-1-preinstall  785/63                               pkg://solaris/group/prerequisite/oracle/oracle-rdbms-server-12cR1-preinstall 4164/6                             pkg://solaris/system/kernel/dynamic-reconfiguration/ultra-enterprise-10000 6182/638                                                                          
Building ISO image...done.

ISO image and instructions for using the ISO image are at:
/Create_a_Local_Repository/sol-11_2-repo.iso
/Create_a_Local_Repository/README-repo-iso.txt

2015年1月7日 星期三

Solaris 11 建立Non-GlobeZone

Solaris 11 建立Non-GlobeZone

步驟 1: 組態一個 Oracle Solaris Zone

root@NIASc11:~# zonecfg -z LDAPc25
Use 'create' to begin configuring a new zone.
zonecfg:LDAPc25> create
create: Using system default template 'SYSdefault'
zonecfg:LDAPc25> set zonepath=/rpool/LDAPc25
zonecfg:LDAPc25> set ip-type=exclusive
zonecfg:LDAPc25> add net
zonecfg:LDAPc25:net> set physical=vnic22
zonecfg:LDAPc25:net> end
zonecfg:LDAPc25> verify
zonecfg:LDAPc25> commit
zonecfg:LDAPc25> exit
root@NIASc11:~#


步驟 2: 檢視既有實體網路卡

root@NIASc11:/# dladm show-link
LINK                CLASS     MTU    STATE    OVER
net1                phys      1500   unknown  --
net3                phys      1500   unknown  --
net0                phys      1500   down     --
net2                phys      1500   unknown  --
net4                phys      1500   up       --

步驟 3: 檢視既有的zone

root@NIASc11:/# zoneadm list -cv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              solaris  shared
   - WPSc14           configured /rpool/WPSc14                  solaris  excl
root@NIASc11:/#


步驟 4: zone進行安裝

root@NIASc11:~# zonecfg -z LDAPc25
Use 'create' to begin configuring a new zone.
zonecfg:LDAPc25> create
create: Using system default template 'SYSdefault'
zonecfg:LDAPc25> set zonepath=/rpool/LDAPc25
zonecfg:LDAPc25> set ip-type=exclusive
zonecfg:LDAPc25> add net
zonecfg:LDAPc25:net> set physical=vnic22
zonecfg:LDAPc25:net> end
zonecfg:LDAPc25> verify
zonecfg:LDAPc25> commit
zonecfg:LDAPc25> exit
root@NIASc11:~#
root@NIASc11:~# zonecfg -z LDAPc25
zonecfg:LDAPc25>
zonecfg:LDAPc25> exit
root@NIASc11:~# zonecfg -z LDAPc25 info
zonename: LDAPc25
zonepath: /rpool/LDAPc25
brand: solaris
autoboot: false
bootargs:
file-mac-profile:
pool:
limitpriv:
scheduling-class:
ip-type: exclusive
hostid:
fs-allowed:
net:
        address not specified
        allowed-address not specified
        configure-allowed-address: true
        physical: vnic22
        defrouter not specified
anet:
        linkname: net0
        lower-link: auto
        allowed-address not specified
        configure-allowed-address: true
        defrouter not specified
        allowed-dhcp-cids not specified
        link-protection: mac-nospoof
        mac-address: random
        mac-prefix not specified
        mac-slot not specified
        vlan-id not specified
        priority not specified
        rxrings not specified
        txrings not specified
        mtu not specified
        maxbw not specified
        rxfanout not specified
        vsi-typeid not specified
        vsi-vers not specified
        vsi-mgrid not specified
        etsbw-lcl not specified
        cos not specified
        pkey not specified
        linkmode not specified
root@NIASc11:~# zoneadm -z LDAPc25 install
The following ZFS file system(s) have been created:
    rpool/LDAPc25
Progress being logged to /var/log/zones/zoneadm.20150108T013249Z.LDAPc25.install
       Image: Preparing at /rpool/LDAPc25/root.

 AI Manifest: /tmp/manifest.xml.dIamYh
  SC Profile: /usr/share/auto_install/sc_profiles/enable_sci.xml
    Zonename: LDAPc25
Installation: Starting ...

              Creating IPS image
Startup linked: 1/1 done
              Installing packages from:
                  solaris
                      origin:  http://localhost:1008/solaris/0510c4fdfd843bf4a51917054b0f1333bf49ac1c/
                      origin:  http://localhost:1008/solaris/33e7b8fb0407c4db142ba0b7e9f2a8f70fb128cd/
DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
Completed                            187/187   34347/34347  248.9/248.9  1.6M/s

PHASE                                          ITEMS
Installing new actions                   48240/48240
Updating package state database                 Done
Updating image state                            Done
Creating fast lookup database                   Done
Installation: Succeeded

        Note: Man pages can be obtained by installing pkg:/system/manual

 done.

        Done: Installation completed in 569.785 seconds.


  Next Steps: Boot the zone, then log into the zone console (zlogin -C)

              to complete the configuration process.

Log saved in non-global zone as /rpool/LDAPc25/root/var/log/zones/zoneadm.20150108T013249Z.LDAPc25.install
root@NIASc11:~# zoneadm list -iv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              solaris  shared
   3 WPSc14           running    /rpool/WPSc14                  solaris  excl
   - LDAPc25          installed  /rpool/LDAPc25                 solaris  excl
root@NIASc11:~# zoneadm -z LDAPc25 boot

root@NIASc11:~#
root@NIASc11:~# zoneadm list -v
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              solaris  shared
   3 WPSc14           running    /rpool/WPSc14                  solaris  excl
   4 LDAPc25          running    /rpool/LDAPc25                 solaris  excl
root@NIASc11:~# zlogin -C LDAPc25
[Connected to zone 'LDAPc25' console]
115/115

                           System Configuration Tool

     System Configuration Tool enables you to specify the following
     configuration parameters for your newly-installed Oracle Solaris 11
     system:
     - network, time zone, user and root accounts, name services

     System Configuration Tool produces an SMF profile file in
     /system/volatile/scit_profile.xml.

     How to navigate through this tool:
     - Use the function keys listed at the bottom of each screen to move
       from screen to screen and to perform other operations.
     - Use the up/down arrow keys to change the selection or to move
       between input fields.
     - If your keyboard does not have function keys, or they do not
       respond, press ESC; the legend at the bottom of the screen will
       change to show the ESC keys for navigation and other functions.




  F2_Continue  F6_Help  F9_Quit

Solaris 變更主機名稱

1 - 檢查目前的環境的屬性參數:

root@t3-2:~# svccfg -s system/identity:node listprop config
config                       application
config/enable_mapping       boolean     true
config/ignore_dhcp_hostname boolean     false
config/loopback             astring
config/nodename             astring     t3-2

root@t3-2:~#

目前主機名稱為t3-2

2 - 設定新的主機名稱
root@t3-2:~# svccfg -s system/identity:node setprop config/nodename="NIASc11"
root@t3-2:~# svccfg -s system/identity:node setprop config/loopback="NIASc11"
改設定主機名稱為NIASc11

3- 更新屬性參數:
root@t3-2:~# svccfg -s system/identity:node refresh
root@t3-2:~# Hostname: NIASc11

4 - 重新啟動服務:

root@t3-2:~# svcadm restart system/identity:node

5 - 確認變更完成:
root@t3-2:~# svccfg -s system/identity:node listprop config
config                       application
config/enable_mapping       boolean     true
config/ignore_dhcp_hostname boolean     false
config/nodename             astring     NIASc11
config/loopback             astring     NIASc11