Archive for March 19th, 2008

Solaris Zones Cont…

##### Zlogin – is used to login zones ####
bash-3.00# ps -ef |grep z
    root  5295     1   0 19:37:46 ?           0:00 zoneadmd -z testzone1
    root  5296     1   0 19:37:47 ?           0:00 zsched

Note: each non-global zone maintains a console. Use ‘zlogin -C zonename’
after installing zone to complete zone configuration.

Zlogin: permits login to non-global zones via the following methods.
1. Interactive – i.e. zling -l username zonename
2. Non-interactive – zlogin options command
3. Console mode – zlogin -C zonename (analog serial connection )
4. Safe mode – zlogin –S

bash-3.00# zlogin -C testzone1
[Connected to zone 'testzone1' console]

### Reboot the zone ###

bash3.00#zoneadm -z testzone1 reboot
bash3.00#zoneadm -z testzone1 shutdown

To exit console ~.


 

No Comments

Solaris Zones

#### Solaris Zones #####

Features:
1. Virtualization
2. Solaris Zones can host only instances of Solaris. Not other OSs.
3. Limit of 8192 zones per Solaris hosts.
4. Primary zone (global) has access to All zones
5. Non-global zones, do NOT have access to other non-global zones.
6. Default non-global zones derive packages from global zones.
7. Program isolation – zone 1 ( Apache ), zone 2 ( MySQL ), zone 3 ( DNS )
8. Provides ‘z’ commands to manage zones: zlogin, zonename, zoneadm, zonecfg

bash-3.00# which zonename
/usr/bin/zonename

bash-3.00# zonename
global

#### Features of GLOBAL zone #####
1. Solaris ALWAYS boots (cold/warm) to the global zone
2. Knows about ALL hardware devices attached to the system
3. Knows about ALL non-global zones

#### Features of NON-GLOBAL zones #####
1. Installed at a location on the filesystem of the Global Zone ‘zone root path’ /export/home/zones/{zone1, zone2,zone3…}
2. Share packages with GLOBAL zone
3. Manage distinct hostname and tables files
4. Cannot communicate with other non-global zones by default. NIC must be used, which means, use standard network API ( TCP )
5. GLOBAL zone admin. can delegate non-global zone administration

#####Zone Configuration##############
Use: zonecfg – to configure zones
Note: zonecfg can be run: interactive, non-interactively, command-file modes.

Requirements for non.global zones:
1. hostname
2. zone root path. i.e. /export/home/zones/testzone1
3. IP address – bound to logical or physical interface
( 100 MB minimum configuration )

Zone types:
1. Sparse Root Zones – share key files with global zone
2. Whole Root Zones ( Totally independed, require more storage)

Steps for configuring non-global zone:

1. mkdir

bash-3.00# mkdir /export/home/zones
bash-3.00# mkdir /export/home/zones/testzone1 && chmod 700 /export/home/zones/testzone1

2. zonecfg -z  testzone1
3. create
4. set zonepath=/export/home/zones/testzone1 – sets roots zone
5. add net 
6. set address=192.168.1.60 
7. set physical=pcn0  
8. end
9. (optional) set autoboot=true – testzone1 will be started when the system boots
10. (optional ) add attr ; set name=comment; set type=string; set value=”TestZone1”
11. verify – verifies zone for erros.
12. commit – commit changes
13. Zone installation – zoneadm -z testzone1 install
‘testzone1’ into ‘installed’ state NOT ready for production.
14. zoneadm -z testzone1 boot – boot zone

bash-3.00# zonecfg -z  testzone1
testzone1: No such zone configured
Use ‘create’ to begin configuring a new zone.
zonecfg:testzone1>
zonecfg:testzone1> create
zonecfg:testzone1> set zonepath=/export/home/zones/testzone1
zonecfg:testzone1> set address=192.168.1.60
zonecfg:testzone1> add net
zonecfg:testzone1:net> set address=192.168.1.60
zonecfg:testzone1:net> set physical=pcn0
zonecfg:testzone1:net> end
zonecfg:testzone1> info
zonename: testzone1
zonepath: /export/home/zones/testzone1
brand: native
autoboot: false
bootargs:
pool:
limitpriv:
scheduling-class:
ip-type: shared
inherit-pkg-dir:
        dir: /lib
inherit-pkg-dir:
        dir: /platform
inherit-pkg-dir:
        dir: /sbin
inherit-pkg-dir:
        dir: /usr
net:
        address: 192.168.1.60
        physical: pcn0
zonecfg:testzone1> set autoboot=true
zonecfg:testzone1>

 zonecfg:testzone1> add attr
zonecfg:testzone1:attr> set name=comment
zonecfg:testzone1:attr> set type=string
zonecfg:testzone1:attr> set value=”TestZone1″
zonecfg:testzone1:attr> end
zonecfg:testzone1> info
zonename: testzone1
zonepath: /export/home/zones/testzone1
brand: native
autoboot: true
bootargs:
pool:
limitpriv:
scheduling-class:
ip-type: shared
inherit-pkg-dir:
        dir: /lib
inherit-pkg-dir:
        dir: /platform
inherit-pkg-dir:
        dir: /sbin
inherit-pkg-dir:
        dir: /usr
net:
        address: 192.168.1.60
        physical: pcn0
attr:
        name: comment
        type: string
        value: TestZone1
zonecfg:testzone1> end
The end command only makes sense in the resource scope.
zonecfg:testzone1> verify
zonecfg:testzone1>

 bash-3.00# zoneadm list -iv
  ID NAME             STATUS     PATH                           BRAND    IP   
   0 global           running    /                              native   shared

bash-3.00# zonecfg -z testzone1 info
zonename: testzone1
zonepath: /export/home/zones/testzone1
brand: native
autoboot: true
bootargs:
pool:
limitpriv:
scheduling-class:
ip-type: shared
inherit-pkg-dir:
        dir: /lib
inherit-pkg-dir:
        dir: /platform
inherit-pkg-dir:
        dir: /sbin
inherit-pkg-dir:
        dir: /usr
net:
        address: 192.168.1.60
        physical: pcn0
attr:
        name: comment
        type: string
        value: TestZone1

bash-3.00# zoneadm -z testzone1 install
Preparing to install zone <testzone1>.
Creating list of files to copy from the global zone.
Copying <7644> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <1045> packages on the zone.
Initialized <1045> packages on zone.                                
Zone <testzone1> is initialized.
The file </export/home/zones/testzone1/root/var/sadm/system/logs/install_log> contains a log of the zone installation.

bash-3.00# zoneadm list -iv
  ID NAME             STATUS     PATH                               BRAND    IP   
   0 global           running    /                                         native   shared
 - testzone1        installed  /export/home/zones/testzone1   native   shared

bash-3.00# zoneadm -z testzone1 boot
zoneadm: zone ‘testzone1′: WARNING: pcn0:1: no matching subnet found in netmasks(4) for 192.168.1.60; using default of 255.255.255.0.
bash-3.00# echo $?
0

 

No Comments

zfs Snapshots / Clones

bash-3.00# zfs create poolraidz1/home

bash-3.00# zfs list
NAME              USED  AVAIL  REFER  MOUNTPOINT
poolraidz1        121K  9.78G  24.5K  /poolraidz1
poolraidz1/home  24.5K  9.78G  24.5K  /poolraidz1/home

Quota:
bash-3.00# zfs set quota=4G poolraidz1/home

bash-3.00# zfs list
NAME              USED  AVAIL  REFER  MOUNTPOINT
poolraidz1        122K  9.78G  25.5K  /poolraidz1
poolraidz1/home  24.5K  4.00G  24.5K  /poolraidz1/home

############ ZFS Snapshots #################

Features:
1. Read-only copies of volumes or file systems
2. Use no additional space, initially

####Return available snapshot
bash-3.00# zfs list -t snapshot
no datasets available

###Create spanpshot##########
bash-3.00# zfs snapshot poolraidz1/home@homespan1
bash-3.00# echo $?
0

bash-3.00# zfs list -t snapshot
NAME                        USED  AVAIL  REFER  MOUNTPOINT
poolraidz1/home@homespan1      0      -  24.5K  -

hidden directory spanshots
/poolraidz1/home/.zfs/snapshot/homespan1

test snapshots
bash-3.00# cd /poolraidz1/home/
bash-3.00# echo “testint spanshot 3″ > test.txt
bash-3.00# zfs snapshot poolraidz1/home@homespan3

#### Destroy Snapshots ###############
bash-3.00# zfs destroy poolraidz1/home@homesnap1

#### Rename Snapshots ###############
bash-3.00# zfs rename poolraidz1/home@homespan2 poolraidz1/home@homespandos
bash-3.00# zfs list -t snapshot
NAME                          USED  AVAIL  REFER  MOUNTPOINT
poolraidz1/home@homespandos  22.5K      -  24.5K  -
poolraidz1/home@homespan3      23K      -    25K  -

####   Roll backs   #########################
bash-3.00#zfs rollback -f poolraidz1/home@homesnap3
bash-3.00#echo $?


####   CLONES ###################
( First create a snapshot and then a clone)

Features:
1. Writable file systems or volumes
2. Linked to a snapshot
3. Clone can be stored anywhere in ZFS hierarchy

bash-3.00# zfs clone poolraidz1/home@homesnap3 poolraidz1/homeclone1   
bash-3.00# echo $?
0

the clone inherited attributes of the target file system
snapshots do not inherited attributes

 

No Comments

ZFS Redundacy

1. Mirroring – RAID – 1
2. RAID – 5 – RAID -Z

bash-3.00# format
Searching for disks…done

AVAILABLE DISK SELECTIONS:
       0. c0d0 <DEFAULT cyl 2607 alt 2 hd 255 sec 63>
          /pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0
       1. c0d1 <DEFAULT cyl 1303 alt 2 hd 255 sec 63>
          /pci@0,0/pci-ide@7,1/ide@0/cmdk@1,0
       2. c1d1 <DEFAULT cyl 1303 alt 2 hd 255 sec 63>
          /pci@0,0/pci-ide@7,1/ide@1/cmdk@1,0

Virtual Devices:
1. c0d1 – 10.0G
2. c1d1 – 10.0G

Note: Redundacy/Replication is associated directly with the pool

Tip: For PRODUCTION enviroments ideally you should implement your mirror, raid z, straight volumnes dedicating THE ENTIRE DISK to zfs (the disks should be the same )

 ******************** MIRROR **********************

bash-3.00# zpool create poolmirror1 mirror c0d1 c1d1
bash-3.00# echo $?
0

bash-3.00# zfs list
NAME          USED  AVAIL  REFER  MOUNTPOINT
poolmirror1    86K  9.78G  24.5K  /poolmirror1

bash-3.00# ls -ltr /poolmirror1/
total 0

### CREATE Dir HOME ######

bash-3.00# zfs create poolmirror1/home
 
ash-3.00# zfs list
NAME               USED  AVAIL  REFER  MOUNTPOINT
poolmirror1        114K  9.78G  25.5K  /poolmirror1
poolmirror1/home  24.5K  9.78G  24.5K  /poolmirror1/home

 ******************** raid-z **********************

# Create the pool
bash-3.00#/usr/sbin/zpool create -f poolraidz1 raidz c0d1 c1d1

bash-3.00# zfs list
NAME         USED  AVAIL  REFER  MOUNTPOINT
poolraidz1    86K  9.78G  24.5K  /poolraidz1

No Comments

ZFS Web Gui

bash-3.00# ls -ltr /usr/sbin/smcwebserver
lrwxrwxrwx   1 root     root          43 Mar 17 12:11 /usr/sbin/smcwebserver -> ../../usr/share/webconsole/bin/smcwebserver

bash-3.00# netstat -anP tcp | grep 6789
      *.6789               *.*                0      0 49152      0 LISTEN
111.222.233.44.6789  111.222.104.222.3338 65498      0 49368      0 FIN_WAIT_2
111.222.233.44.6789  111.222.104.222.3339 65498      0 49368      0 FIN_WAIT_2

Mozilla
https://localhost:6789/zfs

No Comments