Sunday, May 3, 2009

PROCEDURE OF MIRRORING

PROCEDURE OF MIRRORING
e.g. root disk=c0t0d0 mirror disk=c0t1d0

1) Create 7th slice (e.g c0t0d0s7 100mb)

2) prtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t1d0s2

3) metadb -afc 3 c0t0d0s7 c0t1d0s7

4) metadb (to check whether metadb is created or not)

5) metainit -f d11 1 1 c0t0d0s0
metainit -f d12 1 1 c0t1d0s0

metainit -f d21 1 1 c0t0d0s1
metainit -f d22 1 1 c0t1d0s1

metainit -f d31 1 1 c0t0d0s3
metainit -f d32 1 1 c0t1d0s3

metainit -f d41 1 1 c0t0d0s4
metainit -f d42 1 1 c0t1d0s4

metainit -f d51 1 1 c0t0d0s5
metainit -f d52 1 1 c0t1d0s5

metainit -f d61 1 1 c0t0d0s6
metainit -f d62 1 1 c0t1d0s6

6) metastat -p ( to check)

7) metainit d10 -m d11
metainit d20 -m d21
metainit d30 -m d31
metainit d40 -m d41
metainit d50 -m d51
metainit d60 -m d61

8) Take Backup of system and vfstab files

cp -p /etc/system /etc/system.org
cp -p /etc/vfstab /etc/vfstab.org

9) metaroot d10 (Modifies /"root" entry in vfstab)
lockfs -af

It will do changes in /etc/system file & /etc/vfstab file

In vfstab file /dev/md/dsk/d10 will appear & make manual changes to
replace /dev/dsk/c0t0d0s1 by /dev/md/dsk/d20.

10) Enter the following line in system file

set md:mirrored_root_flag=1


11) init 6

12) dumpadm -d swap

13) metattach d10 d12
metattach d20 d22
metattach d30 d32
metattach d40 d42
metattach d50 d52
metattach d60 d62

14) To check mirroring progress give

# metastat -i | grep %


15) eeprom "use-nvramrc?=true"

eeprom boot-device="rootdisk rootmirror net"

eeprom "nvramrc=devalias rootdisk /pci@0/pci@0/pci@2/scsi@0/disk@0,0 devalias rootmirror /pci@0/pci@0/pci@2/scsi@0/disk@1,0"

Friday, March 27, 2009

Solaris IP Multipathing

I've setup lots of machines for IPMP (IP Multipathing), so I thought I would share a simpler step by step approach.
  • Get 2 NIC's in your machine (most of sun servers have multiple NIC's built-in). Not compulsory to have same type of NIC, but it's important that they have the same speed capability.
  • Obtain 3 IP addresses in the same local LAN or (VLAN) segment. In IPMP there are 2 fixed (or private) addresses and 1 floating (or public) address. The 2 fixed addresses I refer to as internal. The 1 floating addresses is the external one. If one of the NICs detects link failure, the address tied to that NIC fails over to the working NIC. When the NIC comes back up, the address fails back to its original home. Determine right now which will be your internal IPs and which will be your external. I recommend keeping the same convention for all Multipath machines, no matter what convention you choose. Here are two typical conventions
  1. The 1st IP is floating
  2. Next 2 IPs are fixed
  • Edit /etc/hosts with your 3IPs. Example:
192.168.200.11 host loghost #External IP
192.168.200.12 host-e1000g0 # Internal IP for NIC 1
192.168.200.13 host-nxge0 # Internal IP for NIC 2
  • Configure network interfaces.
You need to configure the secondary interface and make it have a unique ether address that is persistent across reboots.
# eeprom 'local-mac-address?=true'
  • Setup hostname.* files.
You can pretty much copy these two files as is and just modify them slightly to fit your naming conventions in the same way that you setup the /etc/hosts file above.

/etc/hostname.e1000g0
host-e1000g0 netmask + broadcast + group ipmp0 deprecated –failover up \
addif host netmask + broadcast + failover up

/etc/hostname.nxge0
host-nxge0 netmask + broadcast + group ipmp0 deprecated –failover up
  • make it active
# ifconfig –a unplumb; ifconfig lo0 plumb; svcadm restart physical

Thursday, January 1, 2009

Solaris Zones

Introduction
Zones are virtual process environments in Solaris 10 that allows system administrator to isolate process in one zone from processes in another zone. Zones have their own (chroot) storage environment which again separates data between zones.
This post is an introduction into Solaris zones. Kindly read the Solaris zones commands quick reference for actual commands involved in managing zones.

Zone Types











TypeAbbr.Definition
Container
Zone with resource management controls
Global zoneGZThe base OS installation. Is always present.
Local zoneLZAny zone created manually by the administrator. Aka. non-global zone
Non-global zoneNGZAny zone created manually by the administrator. Aka. local zone

Zone Storage Models
  • Sparse root model :- Any zone that shares any of the /lib, /platform, /sbin or /usr directories with the GZ is called a sparse root model zone.
  • Whole root model :- Any zone not sharing directories with the GZ is called a whole root model zone.
Zone Features
  1. Granularity :- Zones can run on any number of available CPUs and amount of available memory
  2. Isolate :- Run the same application with different configurations
  3. Security :- Hacking one zone does not compromise applications running in other zones
  4. Transparency :- Applications do not need to be recompiled to run in zones (except for some privileged operations)
  5. Virtualization :- Hide configuration information from applications
  6. Memory capping :- Manage the memory usage of zones
  7. Dynamic resource pools :- Assign CPUs to zones
  8. Fair share scheduler :- Grant a zone minimal CPU usage
Zone states
  • A running zone cannot be brought back to the ready state. A halt on a running zone will bring the zone back to the installed state.
  • A zone doesn't have to be booted into the ready state before it can enter the running state. Issuing the zoneadm -z zone boot command on a zone in the installed state will have the zone be booted into the running state
Directories
/etc/zones -
Zone configuration files

Zone daemons and software package parameters
Daemons
  1. zoneadmd : Responsible for booting and shutting down zones
  2. zsched : Keeps track of kernel threads belonging to zones
Software package parameters
  1. SUNW_PKG_ALLZONES - Determines the type of zone in which a package can be installed
  2. SUNW_PKG_HOLLOW - Determines the visibility of the package in a zone
  3. SUNW_PKG_THISZONE - Determines if the package must be installed in the current zone only

Commands

/usr/sbin/zlogin : Log in to zones
/usr/sbin/zoneadm : Administer zones
/usr/sbin/zonecfg : (re)Configure zones
/usr/bin/zonename : Print current zonename

Zone Configuration
  • Basic zone configuration
    root@srv# zonecfg -z zone
    zonecfg:zone>create
    zonecfg:zone>set zonepath=/zones/zone
    zonecfg:zone>set autoboot=true
    zonecfg:zone>set pool=zone_pool

  • Storage Configuration
    UFS
    zonecfg:zone>add fs
    zonecfg:zone:fs>set dir=/ufs
    zonecfg:zone:fs>set special=/dev/dsk/c1t1d0s5
    zonecfg:zone:fs>set raw=/dev/rdsk/c1t1d0s5
    zonecfg:zone:fs>set type=ufs
    zonecfg:zone:fs>set options=rw
    zonecfg:zone:fs>end
    LOFS
    zonecfg:zone>add fs
    zonecfg:zone:fs>set dir=/lofs
    zonecfg:zone:fs>set special=/global/dir
    zonecfg:zone:fs>set type=lofs
    zonecfg:zone:fs>end
    ZFS file system
    zonecfg:zone>add fs
    zonecfg:zone:fs>set dir=/zfs
    zonecfg:zone:fs>set special=pool/data
    zonecfg:zone:fs>set type=zfs
    zonecfg:zone:fs>end
    ZFS dataset
    zonecfg:zone>add dataset
    zonecfg:zone:dataset>set name=pool/dataset
    zonecfg:zone:dataset>end
    ZFS volume
    zonecfg:zone>add device
    zonecfg:zone:device>set match=/dev/zvol/dsk/pool/volume
    zonecfg:zone:device>end
    zonecfg:zone>add device
    zonecfg:zone:device>set match=/dev/zvol/rdsk/pool/volume
    zonecfg:zone:device>end
    Inherit-pkg-dir
    zonecfg:zone>add inherit-pkg-dir
    zonecfg:zone:inherit-pkg-dir>set dir=/opt
    zonecfg:zone:inherit-pkg-dir>end
  • Network configuration
    zonecfg:zone>add net
    zonecfg:zone:net>set physical=e1000g0
    zonecfg:zone:net>set address=172.16.20.12/24
    zonecfg:zone:net>end
  • Device configuration
    zonecfg:zone>add device
    zonecfg:zone:device>set match=/dev/rmt/*
    zonecfg:zone:device>end
  • Resource configuration
    Fair Share Scheduler (FSS)
    zonecfg:zone>add rctl
    zonecfg:zone:rctl>set name=zone.cpu-shares
    zonecfg:zone:rctl>add value (priv=privileged,limit=20,action=none)
    zonecfg:zone:rctl>end
  • Extra attributes
    zonecfg:zone>add attr
    zonecfg:zone:attr>set name=creator
    zonecfg:zone:attr>set type=string
    zonecfg:zone:attr>set value="Sys Admin"
    zonecfg:zone:attr>end

  • Save configuration
    zonecfg:zone>info
    zonecfg:zone>verify
    zonecfg:zone>commit
    zonecfg:zone>exit

After this check directory or filesystem with /zones/zone is available with 700 permissions and check and start installation
#zoneadm -z zone verify
#zoneadm -z zone install
#zoneadm -z zone boot
#zlogin -C zone --> For Console of Zone