Wednesday, 27 February 2008

Solaris 10 Zones command crib

Zones command crib
----------------------------------
List available zones

zoneadm list –v
-----------------------------------

List status of zones

zoneadm list -cp
-----------------------------------

Login to zone

zlogin –C zonename
-----------------------------------

Logout of a local zone while in a console session / logout of a local zone when logged in from the global zone

~~~.

Logout of a global zone
~.
-----------------------------------

Determine what zone you are in

zonename
-----------------------------------

Command to discover if zone is sparse or whole
# pkgcond is_whole_root_nonglobal_zone
# echo $?
1
# pkgcond is_sparse_root_nonglobal_zone
# echo $?
0

so here the zone is sparse
-----------------------------------

How to get data from a zone without logging into it

(from the global zone)

zlogin zonename cmd

eg

zlogin zonename1 iostat –En
-----------------------------------
From the global zone, show disk stats in human readable form with zone areas included

df –hZ



From the global zone, show processes that are running including zone procs


ps –ef Z

-----------------------------------

Determine disk usage of zones within the partition they reside


du –sk /xx/xx/zonenames*



eg



du –sk /zone/zp*

-----------------------------------------

Determine CPU utilization from the global zone


prstat –Z

-----------------------------------------

Booting a zone


(from the global zone)



zoneadm –z zonename boot

-----------------------------------------

Rebooting a zone


(from the global zone)



zoneadm –z zonename reboot

-----------------------------------------

Halting a zone


(from the global zone – this is used to remove both the application environment and virtual platform for a zone – Zone status is then brought to the ‘installed’ state. All processes are killed, devices unconfigured, network interfaces unplumbed, file systems are unmounted and kernel data structures destroyed)



zoneadm –z zonename halt

-----------------------------------------

Deleting a Zone


(from the global zone, the assumption is that the zone has been halted prior to these actions)



zoneadm –z zonename uninstall



zonecfg –z zonename delete



You can confirm the status of the zone at any time with



zoneadm list –cp

How many processes a user can have in Solaris?

How to determine how many processes a user can have in Solaris.

Use the sysdef -i command, and grep for processes - see below;


root@server # sysdef -i | grep processes

30000 maximum number of processes (v.v_proc)

29995 maximum processes per user id (v.v_maxup)

Sorting out the Disk hogs!

Sorting out the disk hogs

If you have a full or near full fs, or you are being proactive and doing some preventative housekeeping on directories etc, here are some good commands to use;


du /export/home | sort –nr | more

using this alongside

find /export/home –mtime 1


will get you a pretty good picture of what you want to look at. Note that /export/home is just an example used here, but usually you are looking around that area anyway (or its a good place to start, especially if it sits under the root filesystem)


Alternatively, this is a powerful command;

du –sk * | sort –rnk1

Troubleshooting a slow ssh connection

Troubleshooting a slow ssh connection

Try looking in the /etc/nsswitch.conf file in the first instance - it could be that there is a DNS entry on the hosts line;

passwd: files
group: files
hosts: files DNS
ipnodes: files
networks: files
protocols: files
rpc: files
ethers: files
netmasks: files
bootparams: files
publickey: files


edit the line to get rid of the DNS