Most Operating Systems Aside from Microsoft’s Windows based are traces its heritage back to Unix. Ex: Solaris, IBM AIX, Linux, Mac OS X, Android, iOS, Chrome OS are often called “Unix-like” operating systems. Network Security

Data Center Consolidation

Data center consolidation is the process of reducing the volume of physical IT assets through highly efficient and scalable technologies. Organizations leverage data center consolidation to reduce operating costs.

Analyse and Solve Serious Hardware and Sofware Problems

Listing several basic hardware and software troubleshooting steps with respect to operating systems, software programs, and computer hardware.

Mission Critical Systems

A mission critical system is a system that is essential to the survival of a business or organization. When a mission critical system fails or is interrupted, business operations are significantly impacted.

The best server hardware to maximize IT performance

Data center hardware advances target new workloads such as big data processing, as well as higher efficiency for existing apps and services. The best server hardware for your data center depends on existing and planned application architectures, data center operations staff skills and of course the IT budget.

Sunday, November 20, 2016

Mount Windows CDROM in Linux

Make sure your have samba configured and running smbmount //192.188.101.133/D /mnt/cd -o username=mpasha,workgroup=saudilighting,password=userpwd

VNC in Linux

VNC server config I am trying to configure VNC server following instructions below VNC Server configuration Setting up VNC server in RHEL or Fedora. 1. up2date vnc-server (RHEL) or yum install vnc-server (Fedora) if you don't have it installed. 2. Edit /etc/sysconfig/vncservers as root. Uncomment the line: VNCSERVERS="1:put_the_user_you_will_log_in_as_here" The server will default to the resolution of the machine, so if you are going to connect to a desktop with a high resolution monitor from a laptop you will want to uncomment and set the following line also: VNCSERVERARGS[1]="-geometry 1024x768" 3. chkconfig vncserver on 4. su to the user that you will be logging in as. 5. Run vncpasswd and set the password. 6. Now run vncserver. This will create the needed initialization files. 7. Edit /home/user/.vnc/xstartup and uncomment the two lines there to get a normal desktop when you log in. 8. Now kill the Xvnc task and delete the lock files in the .vnc directory 9. service vncserver start (there might be some other lock files you need to delete; I can't remember now - check any error messages here) 10. Unfirewall 5901 tcp to allow remote connections 11. Connect from the remote machine using servername:1 To attach to the session that is running on the monitor of the machine - the session of currently logged in local user, use krfb (on the server) and krdc (on the client) for KDE, and vino for Gnome. --------------------------------------------------------------------------- I am unable to execute step 7: Edit /home/user/.vnc/xstartup and uncomment the two lines there to get a normal desktop when you log in. If I go under /home directory - I do not see any thing their. It is blank. How will I be able to implement step7. I am totally a windows person and newbie to Linux

Forcefully unmount a Linux disk partition

How do I forcefully unmount a Linux disk partition? It happens many times you try to unmount a disk partition or mounted CD/DVD disk and if you try to unmount device, which is accessed by other users, then you will get error umount: /xxx: device is busy. However, Linux/FreeBSD comes with fuser command to kill forcefully mounted partition. Understanding device error busy error What happens basically, is that Linux / UNIX will not allow you to unmount a device that is busy. There are many reasons for this (such as program accessing partition or open file) , but the most important one is to prevent data loss. Try the following command to find out what processes have activities on the device/partition. If your device name is /dev/sdb1, enter the following command as root user: # lsof | grep '/dev/sda1' Output: vi 4453 vivek 3u BLK 8,1 8167 /dev/sda1Above output tells that user vivek has a vi process running that is using /dev/sda1. All you have to do is stop vi process and run umount again. As soon as that program terminates its task, the device will no longer be busy and you can unmount it with the following command: # umount /dev/sda1 Following disussion allows you to unmout device and partition forcefully using Linux commands. Linux fuser command to forcefully unmount a disk partition Suppose you have /dev/sda1 mounted on /mnt directory then you can use fuser command as follows: WARNING! These examples may result into data loss if not executed properly (see "Understanding device error busy error" for more information). Type the command to unmount /mnt forcefully: # fuser -km /mnt Where, -k : Kill processes accessing the file. -m : Name specifies a file on a mounted file system or a block device that is mounted. In above example you are using /mnt Linux umount command to unmount a disk partition You can also try umount command with –l option: # umount -l /mnt Where, -l : Also known as Lazy unmount. Detach the filesystem from the filesystem hierarchy now, and cleanup all references to the filesystem as soon as it is not busy anymore. This option works with kernel version 2.4.11+ and above only. If you would like to unmount a NFS mount point then try following command: # umount -f /mnt Where, -f: Force unmount in case of an unreachable NFS system Caution: Using these commands or option can cause data loss for open files; programs which access files after the file system has been unmounted will get an error.

Get Tape Serial Num in Linux

[root@vmbackup dev]# sg_inq /dev/st0 standard INQUIRY: PQual=0 Device_type=1 RMB=1 \[ANSI_version=3] version=0x03 \[AERC=0] \[TrmTsk=0] NormACA=0 HiSUP=0 Resp_data_format=2 SCCS=0 ACC=0 ALUA=0 3PC=0 Protect=0 BQue=0 EncServ=0 MultiP=0 MChngr=0 \[ACKREQQ=0] Addr16=1 \[RelAdr=0] WBus16=1 Sync=1 Linked=0 \[TranDis=0] CmdQue=0 Clocking=0x3 QAS=0 IUS=0 length=96 (0x60) Peripheral device type: tape Vendor identification: HP Product identification: Ultrium 2-SCSI Product revision level: F48D Product serial number: HUL3M04080

How to Reset "root" Password with GRUB on Enterprise Linux

How to Reset "root" Password with GRUB on Enterprise Linux If somehow you have lost the password for the system administrator user "root" you will need to reset it. This document provides a practical method to do that if you have configured system with the GRUB boot loader during the OS installation. It procedure is to boot the system in the "single user" mode and to be able to do that you must be on the system console. Please follow the steps below: 1. Reboot the system 2. When the GRUB menu is shown with list of kernels to boot or count down for boot kernel is seen immediately do the following. 3. Use the arrow key and choose the kernel you want to boot 4. Press key a to append kernel arguments before booting 5. Next line will look something like this: grub append> ro root=/dev/VolGroup00/LogVol00 rhgb quiet 6. At the end of the line press space bar once, then add text single or 1: grub append> ro root=/dev/VolGroup00/LogVol00 rhgb quiet single or grub append> ro root=/dev/VolGroup00/LogVol00 rhgb quiet 1 7. Then press enter/return, system will start to boot. The esc key will cancel your edit. 8. This will bring you to a shell prompt and now you can use the passwd command to change the password for the "root" account: sh-3.00## passwd Changing password for user root. New UNIX password: ... ... After the password is reset type # reboot and after system has been completed booting you can logon with the new root password.

How to Close and Open Ports with iptables

How to Close and Open Ports with iptables Linux dedicated servers typically rely a software firewall system called iptables. With it you can control which ports allow inbound and/or outbound access. It is very important to have iptables configured properly, both for your server’s functionality and for its security. There are many tools, both command-line based and web-based that allow you to control and configure iptables. In some cases, particularly emergency situations, you may still prefer or need to use the command line. In such situations, here is an easy guide to follow. As an example, let’s suppose you want to open the TCP port 25 for your SMTP server. 1. Login to your server via SSH 2. Become root: su 3. Enter the following command: iptables -A INPUT -p tcp --dport 25 -j ACCEPT On the other hand, if you wanted to close access to the same port, you would enter: iptables -A INPUT -p tcp --dport 25 -j DROP Once you are finished, save and restart iptables /etc/init.d/iptables save /etc/init.d/iptables restart Notes: 1. Some Linux distributions, such as Red Hat Enterprise Linux and CentOS provide basic iptables management through the “setup” program. Simply run “setup” as root and configure the firewall. 2. If your server uses a web-based control panel to configure the firewall, it is not a good idea to manually play with it except in cases of emergency where you cannot access services (such as the web). 3. Some iptables management software allows you to control it without actually having to use the iptables command.

Tools to Monitor Linux Performance

Linux/Unix System administrators need to monitor and debug Linux System Performance problems every day. It is very hard to monitor and keep systems up and running without using proper tools or utilities. Below are some frequently used command line monitoring tools that might be useful for every Linux/Unix System Administrator. These commands are available under all flavors of Linux and can be useful to monitor and find the actual causes of performance problem.

1. lsof (List Open Files)
Lsof command used in many Linux/Unix like system that is used to display list of all the open files and the processes. The open files included are disk files, network sockets, pipes, devices and processes. One of the main reason for using this command is when a disk cannot be unmounted and displays the error that files are being used or opened. With this command you can easily identify which files are in use. The most common format for this command is.


2. tcpdump (Network Packet Analyzer)
tpdump is one of the most widely used command-line network packet analyzer or packets sniffer program that is used to capture or filter TCP/IP packets which are received or transferred on a specific interface over the network. It also provides a option to save captured packages in a file for later analysis. tcpdump is almost available in all major Linux distributions.


3. netstat (Network Statistics)
Netstat is a command line tool for monitoring incoming and outgoing network packets statistics as well as interface statistics. It is very useful tool for every system administrator to monitor network performance and troubleshoot network related problems.


4. top (Linux Process Monitoring)
Linux Top command is a performance monitoring program which is used frequently by many system administrators to monitor Linux performance and it is available under many Linux/Unix like operating systems. The top command used to display all the running and active real-time processes in ordered list and refreshes regularly. It display CPU usage, Memory usage, Swap Memory, Cache Size, Buffer Size, Process PID, User, Commands and much more. It also shows high memory and cpu utilization of a running processess. The top command is much useful for system administrator to monitor and take correct action when required.


5. vmstat (Virtual Memory Statistics)
Linux VmStat command used to display statistics of virtual memory, kernel threads, disks, system processes, I/O blocks, interrupts, CPU activity and much more. By default vmstat command is not available under Linux systems you need to install a package called sysstat that includes a vmstat program. The common usage of command format is.


6. iostat (Input/Output Statistics)
IoStat is simple tool that collects and shows system input and output storage device statistics. This tool is often used to trace storage device performance issues including devices, local disks, remote disks such as NFS.

Saturday, November 19, 2016

The history of UNIX systems

The first "Unix" system was developed by Ken Thompson in the Bell AT&T laboratories at Murray Hill in New Jersey in the United States from 1965. Ken Thompson's aim was to develop a simple interactive operating system, called "Multics" (Multiplexed Information and Computing System) in order to run a game which he had created (space travel, a simulation of the solar system).
In April 1969 the AT&T laboratories decided to use the GECOS (General Electric Comprehensive Operating System ) instead of Multics. However, Ken Thompson and Dennis Ritchie who joined the team needed to make the space travel game work on a smaller machine (a DEC PDP-7Programmed Data Processor which only had 4K of memory to make user programs run), this is why they recreated the system in order to create a limited version of Multics called UNICS (UNiplexed Information and Computing Service), quickly shortened to Unix.
The date of 1st January 1970 is considered as the birth date of the UNIX system, which explains why all system clocks for Unix operating systems start from this date.
Alongside these activities, D.Ritchie played a large part in the definition of the C language (since he is considered as one of its creators with B.W.Kernighan), so the whole system was entirely rewritten in C in 1973 and called Unix Time-Sharing System (TSS). 
When the system passed version 7 in 1979, its development was accompanied by many notable modifications such as:
  • the removal of limitations linked to file sizes,
  • better portability of the system (operating on many hardware platforms),
  • the addition of many utilities.
A decree dating from 1956 prevented the company ATT, to which Bell Labs belonged, from marketing anything other than telephone or telegraph equipment, this is why the decision was taken in 1973 to distribute UNIX source into universities for educational purposes.
From the end of 1977 researchers from the University of California redeveloped a version of Unix from source supplied by AT&T in order to run the system on their VAX platforms and called it BSDfor Berkeley Software Development.
So two development branches of the source grew:
  • The AT&T branch which would become System V from UNIX System Labs (USL)
  • BSD (Berkeley Software Development) developed by the University of California
In 1977 AT&T made the UNIX source available to other companies, although a great number of UNIX-like systems were developed:
  • AIX, commercial Unix based on System V developed in February 1990 by IBM
  • Sun Solaris, commercial Unix based on System V and BSD developed by SUN Microsystems
  • HP-UX, commercial Unix based on BSD developed from 1986 by Hewlett Packard
  • Ultrix, commercial Unix developed by DEC
  • IRIX, commercial Unix developed by SGI
  • Unixware, commercial Unix developed by Novell
  • Unix SCO, commercial Unix based on System V developed from 1979 by Santa Cruz Operationsand Hewlett Packard
  • Tru64 UNIX, commercial Unix developed by Compaq
In 1983 AT&T had the right to market its Unix, which marked the appearance of UNIX System V, the commercial version of its Unix system.
In 1985 a Dutch professor called Andrew Tannenbaum developed a minimal operating system called Minix in order to teach system programming to his students. 
In 1991 a Finnish student, Linus Torvalds decided to design, on the Minix model, an operating system capable of running on type 386 architectures. 
He called this operating system "Linux" and posted the following message on the comp.os.minixdiscussion forum:
Hello everybody out there using minix -
I'm doing a (free) operating system (just a hobby,
won't be big and professional like gnu) for 386(486) AT clones.
Here is a non exhaustive diagram retracing the overall appearance of the main Unix type systems:

The UNIX standard

Considering the large number of Unix systems developed based on AT&T's System V or indeed BSD, the question of a Unix standard has been asked since 1981 on the /etc/group discussion forum in order to ensure maximum portability between systems:
  • in 1983, AT&T published SVID (System V Interface Definition) describing System V. This first definition is different from POSIX
  • in 1984 the /etc/group group published POSIX, a series of standards developed through the IEEE(Institute of Electrical and Electronics Engineers). POSIX is therefore also known under the name IEEE P1003.
  • at the same time, a consortium of manufacturers (Sun, IBM, HP, DEC, AT&T, Unisys, ICL, ...) published the X/Open Portability Guide Issue 3 (XPG3) standard. This standard deals in particular with the different issues of geographic localisation (date, alphabet, etc.).

Converting A VMware Image To A Physical Machine

Converting A VMware Image To A Physical Machine


This tutorial shows how to convert an existing CentOS VM to a Physical machine. This tutorial covers the cloning of the VM to an unpartitioned HDD and troubleshoot some of the possible errors that you may have booting the OS on your new hardware. To illustrate this procedure I will use VMware Workstation 7 as the handler to transfer the VM installation to a physical HDD.

1 Requirements
To perform this procedure you will need:
• VMware Workstation, VMware Server or VMware Player.
• CloneZilla ISO image.
• Unpartitioned HDD with enough space to hold your VM image.

2 Preliminary Notes
This tutorial assumes basic knowledge of the cloning process and requires no previous experience on the use of Clonezilla. Make sure your OS is not using in any way the target HDD that will hold your final copy of the VM, otherwise VMware will complain about your disk been in use and CloneZilla will not perform a successful copy of the VM.

3 VMware Configuration
First thing is to make sure your virtual CD/DVD is using your CloneZilla ISO image to boot. Next add your physical HDD as part of your existing VM by clicking the Add button.


Select Hard Drive and click Next.


Select Use physical disk (for advanced users) then click Next.


Make sure you select the correct drive that you want to use for your physical disk and select the option Use entire disk.


Finally give a name to your configuration file then click Finish.


Make sure your final VMware hardware list include this two elements otherwise, start all over.


4 CloneZilla Cloning Process

Start your VMware and boot from your virtual ISO into CloneZilla image. Use the Live option with default settings.


Select your preferred language and continue.


Accept the default option Don't touch keymap and continue.


Select Start_clonezilla and continue.


Select device-device option and continue.


Select Beginner mode and continue.


Select disk to local disk and continue.


Select your source disk and click OK.


Select your target disk and click OK, then press Enter to continue.


You will be presented with a warning, about your existing data on your target disk will be lost, make sure there's nothing usable on your disk before you continue.


You will be presented with a series of questions answer yes to all this prompts.


The cloning process may take a long time.

After the cloning process is finished hit Enter and power off the VM by pressing 0 on the CloneZilla menu.


The cloning process is complete, is now time to install your new HDD to your physical machine.

5 Troubleshooting Physical Machine

More likely your first encounter with your cloned OS will be a filesystem corruption, with the following error: Unexpected Inconsistency. To fix this problem enter your root password and run fsck -y to start the filesystem repair process. The -y answers yes to the questions the fsck command will probably output.


Your next challenge will be fixing your NIC, I have used two different methods to fix this problem.
Go into /etc/udev/rules.d and delete the file 70-persistent-net.rules then reboot. Deleting the file forces the detection process to run again at boot with no baggage left over from the cloning process.

The other way to fix this problem is by edit: /etc/sysconfig/network-scripts/ifcfg-eth0 and add the MAC address of your new NIC.
Open eth0 using vi, type:

vi /etc/sysconfig/network-scripts/ifcfg-eth0

Edit the following line:
HWADDR=
This is my sample config file:
# Micro-Star INT'L CO Gigabit Ethernet Controller
DEVICE=eth0
BOOTPROTO=static
DHCPCLASS=
HWADDR=00:19:B1:2A:BA:B8
IPADDR=10.10.11.50
NETMASK=255.255.255.192
ONBOOT=yes

Save and close the file then reboot the server:

reboot

The system is now ready to be used.

Enabling the VMware vSphere Hot-plug CPU & Hot-Add RAM Feature

Enabling the VMware vSphere Hot-plug CPU & Hot-Add RAM Feature


VMware vSphere’s hot-add Memory and hot-plug CPU functions allow you to add the CPU and Memory while virtual machine is up and running. It will help you to add the additional resources whenever required and no need to bring down the VM for each time. But you can’t remove the resources once you have added the VM while it’s running.

To enable the hot-plug CPU and Hot-add RAM on existing VM.

1. Login to the VMware vSphere Client and Halt the VM.

2. Right click the VM and edit the virtual machine settings.

3. Expand the CPU tab.

4. Navigate to CPU hot Plug option.

5. Select the “Enable CPU Hot Add” Box.

6. Same way you can configure for memory as well. Just enable the Memory Hot plug.




Reference: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2020993

Friday, November 18, 2016

AIX Useful commands

Useful commands
Memory
bootinfo –r    shows how much RAM does my machine has (as root)
lsattr –E –l sys0 –a realmem   shows how much RAM does my machine have (as non root)
rmss -c 512
rmss -r        sets the memory size to 512 MB
resets the memory size to the original one
Devices
lsattr  -El  en0    displays en0 driver params
lsattr  -El  ent0    displays ent0 HW params
lsattr -El rmt0    displays tape params
lscfg -vp -l rmt0    (all information about a tape drive)
lsattr  -El  sys0    displays system type, firmware, etc  driver params
lscfg –v    lists all system HW config (NVRAM)
lsdev –Csscsi    list all scsi devices
lsdev –Cspci    list all pci devices
lsparent –Ck scsi    list all scsi adapters
lsdevfc    list fiberchannel devices
cfgmgr    Configures devices
lsdev -Ccdisk     Shows all disks
lsdev -Cctape              Shows all tapes
cfgmgr -v -l device –v   Specifies verbose output. The cfgmgr command writes information about what it is doing to standard output.
cfgmgr -v -l device      Name Specifies the named device to configure along with its children.
If you only turned on a disk tower at e.g. scsi2 cfgmgr -v -l scsi2 will only configure this with detailed output.
lsdisp    To check which graphic adapter is installed.
lscfg -vp -l mga0     (all information about a adapter)
lscfg -vp -l hdisk0 | grep Machine    gives info about the disk manufacture type
lsslot -c pci    For 6F1 only !!!! Lists all slots ,voltage,boards,etc !!!!
bootlist -m normal cd0  rmt0 hdisk0   Changes the default bootlist
lsmcode -c    display the system firmware level and service processor
lsmcode -r -d scraid0    display the adapter microcode levels for a RAID adapter scraid0
lsmcode -A    display the microcode level for all supported devices
System info
/usr/bin/uname -m    Get machine ID
/usr/bin/uname -M    Get platform type
oslevel    Displays current AIX level
oslevel -r    Displays current AIX maintenance level
oslevel -g    List filesets at levels later than maintenance level !!!
lsps -a    Paging space settings.
lscfg -vp -l proc0  (1,2,3)   (all information about a processor[s])
lscfg -vp -l mem0 |pg    (all information about memory modules installed)
env ulimit    Environment setings - show user ulimit
bootinfo –s hdisk0     Displays disk size
lsattr -El sys0 -a systemid   Determines the system serial number
lscfg –vp|grep ROM|grep -v CD  Determines the system Firmware level
System issues
TERM=vt100      -If you execute a command/application and it responds with msg
‘ The type of your terminal is unknown to the system’,run those commands (In ‘ksh’)
set term=vt100   -Same (In tcsh’)
rcp -rp /dataVolumes/brisque1.1.0/jobs/flower.job sciroot@ripro3:/dataVolumes/ripro3.3.0/jobs/ -Copying a file from one Unix machine (Brisque) to another (Server) the assumption is that both machines know each other’s names (in hosts file)
dd if=/dev/fd0 of=/temp/diskimage bs=4096 -Duplicate a diskette copy from diskette to hard drive
dd if=/temp/diskimage of=/dev/fd0 bs=4096  -copy diskette image onto diskette
/usr/lpp/X11/bin/xset -display unix 0 s off  -Kill display timeout
lsfs -v jfs  -List of Filesystem items.
lsfs -q -v jfs         -you can see also the parameter of a filesystem and thus see if e.g. /backup was or is a big_filesystem_enabled one.
Important for the 2GB File limit.
lsuser –f root    Shows all user parameters (max .file size,etc)
sysdumpdev -L    Check last system dump status
sysdumpdev -l    Check system dump device settings
lslpp -f Upd_Timna_DTM.obj    List contents of the package
Networking
ksh
for ENT in ` lsdev –Cs pci|grep ent | awk '{ print $1 }'|cut –c 1,2,4 `;do
    mktcpip –S $ENT
done
exit      -Shows all interfaces IP config+mask+router+DNS !
host timna1    displays station default IP address – works ONLY in DNS environment
ifconfig en0    displays en0 driver params
netstat  -i    displays network interfaces setting
mktcpip -S en0    #host:addr:mask:_rawname:nameserv:domain:gateway:type:start
syslab18:192.9.100.1:255.255.255.0:en0:10.4.2.12:csil.creoscitex.com:10.4.30.1:N/A:no
GREAT TCPIP info in one command !!!
showmount –e    displays all exported volumes
showmount -a    show who's got my filesystemsses mounted over IP !
lssrc –g tcpip    displays all IP oriented processes status
entstat -drt ent0 |grep –i error    display any communication errors on etn0
entstat -r    Resets all the statistics back to their initial values.
arp -a    shows a local arp cache
cd /usr/local/es/;res    restarts appletalk
netstat  -ptcp    shows IP statistics
netstat  -pudp    shows UDP statistics
netstat  -c
         -s
         -m    client only;
server only
NFS mount
netstat -I en0 10    Trace en0 every 10 seconds
netstat -rn    Display routing info with IP address (10.4.27.182)
netstat -in    Shows the state of all configured interfaces
netstat -r    Display routing info with full hostnames (timna2.csil.creoscitex)
    nfsstat  –z      ;to    reset NFS stats without reboot
cat /etc/resolv.conf    Check DNS settings
stopsrc –g NFS     To stop NFS services on a client
startsrc –g NFS     To start NFS services on a client
traceroute 149.115.39.1    Trace all hobs (interconnections=routers) to the destination  IP
netpmon -o netpmon.out
trcstop    Traces all network processes activity into a logfile. Must be preceede by a trcstop command !
nslookup hostname    Shows the DNS server name and address
ping -R -c 1 bnc2    Ping with displaying the routing info
namerslv -s | grep domain | awk '{ print $2 }'    Displays a fully qualified domain name of a host
rup    Shows the status of a remote host on the local network
nmonnfs    Traces all NFS processes activity
mount hostname:/filesystem /mount-point    Mount an NFS filesystem
mknfsexp -d /directory     Creates an NFS export directory
mknfsmnt                            Creates an NFS mount directory
rmnfs                               Stops and un-configures NFS services
mknfs                               Configures and starts NFS services
exportfs -u (filesystem)            Un-exports a filesystem
exportfs                            Lists all exported filesystems
exportfs -a                        Exports all fs's in /etc/exports file
Disks
synclvodm -vP svg3    synchronizes ODM and the disk VG info.
redefinevg svg3    Redfined VG definition in ODM
lqueryvg -p hdisk0 –Avt  -reads logical volumes info from disk
bootinfo -s hdiskx    Shows Megabytes available even if no volume group is assigned.
lspv -p  hdiskx     (PP's used, location on disk, mount point)
lscfg -vp -l hdiskx      (all information about a disk/raid)
Filesystem
chfs -a size=+200000 /var    increases /var FS by 100MB
du -sk /john          shows directory used space in kb !!!!
mount all    mounts all FS
umount /dataVolumes/rtest9.1.0    unmounts a FS
fuser -k /dev/cd0    Releases a CD that will not unmount !
fuser –c /dataVolumes/rtest9.1.0  -Find out which process_id lock the FS
istat <filename>    Shows when the file was last created/modified/accessed !!!!
System monitoring
istat <filename>    Shows create/modify/access file info
alog -o -t boot | more    displays system boot log
w    Lists login users and their programs.
who    Identifies the users currently logged in
/usr/local/es/swho     Identifies the Ethershare users currently logged in
last  |more    shows last logins
last –20    Shows recent 20 lines
last root    Shows username ‘root’ login/logout record
last ftp     Shows all FTP session in the record
mount    shows all mounted filesystems (nfs+local)
ps -ef    show all running processes
ps -ef |grep Scitex     show all scitex running processes
du -ak /scitex|sort -n -r|head –10  -Display 10 biggest directories on the volume by size
find /scitex -xdev -size +2048 -ls|sort -rn +6|head –10  -to find 10 top files in the root (/) directory larger than 1 MB.”-xdev” helps searching ONLY in “/” !!!!!!!!!
history    Last commands run on the system by this user
alog -ot boot    Lists a log of all boot operations
grep TX /etc/environment    Verify daylight settings
Performance issues
nmon    a nice monitor - runs only on AIX5 and up
topas    a nice monitor - runs only on AIX 4.3.3 and up
monitor -top 10 -s 2    monitors system 10  top processes with 2 seconds
iostat 2    displays disks activity every 2 seconds refresh interval
iostat –a 2            AIX5 ONLY !!!!
displays disks and ADAPTER !!!! activity every 2 seconds refresh interval
vmstat 2    ;monitors virtual memory statistics every 2 seconds (see appendix A)
sar –P ALL 2 2    Show all CPU’s activity on an SMP machine
svmon –i 2    Monitors real and virtual memory
ps auxw | sort –r +3 |head –10  -Shows top 10 memory usage by process
ps auxw | sort –r +2 |head –10  -Shows top 10 CPU usage by process
ps –auw | grep defunct    Shows zombies processes (to kill – reboot or kill the parent)
filemon –O all –o filemon.out ; find / -name core ; trcstop    Traces FS,LV,disks,files activityof a “find” command into a logfile (filemon.out). Must be preceded by a trcstop command.
tprof –x find / -name core ; trcstop    Traces CPU activityof a “find” command Severall logfile are created. Must be preceded by a trcstop command.
tprof -ske -x "sleep 30"    -Trace CPU activity for next 30 seconds.Results in file sleep.tprof
lvmstat –ev svg1
lvmstat –v svg1 2    AIX5 ONLY !!!!
enable gathering the VG statistics
Display VG logical volumes statistics every 2 seconds
Remote issues (working over the modem)
pdelay tty0; pdisable tty0 >/dev/null ;penable tty0
-Resets tty0
stty erase '^?'    Makes bakespace to work
/scitex/version/utils/modem/kermit -l /dev/ttyx –c atdt {phone #}     Use Unix to Dail-out  (for any reason) ttyx is the serial port the cable is connected
/scitex/version/utils/modem/kermit -s /u/d0/ripro_messages -i    Sends a file to a remote desktop in binary mode
/scitex/version/utils/modem/kermit –r
-Receives a file to from remote desktop
Browsing errlog with errpt
errpt -a  -s 0604090601  -e 0605090901    browse the errlog in  detail for all errors within a timeframe
errpt -a  -N SYSPROC |more
errpt -a  -N SYSPROC  > /tmp/err.log    Browse the errlog for the SYSPROC resource, can be into the file
errpt -j 5DFED6F1   -Browse the errlog by the identifier
errpt –A    -AIX5 ONLY !!!! Shows less detailes then errpt -a
errpt –D    -AIX5 ONLY !!!! eliminates double entries
Security issues
chmod -s Filename    Remove Sticky Bit to a file or directory
chmod +r+w+x+t Filename     Add Read+Write+Execute+Temp mode to a file or directory.
This is a ‘blanket’ change for all owner, user & group.
Numeric Access Modes
0 (---) - no access
1 (--x) - execute permissions; search permissions for directories
2 (-w-) - write access
3 (-wx) - execute/search permission and write access
4 (r--) - read access
5 (r-x) - execute/search permission and read access
6 (rw-) - read and write access
7 (rwx) - execute/search permission and read and write access
mkpasswd -f    rebuild the /etc/passwd indexes in case of suspected corruption
Miscellaneous
ksh
find / -type f|xargs grep "10.4.27.181" 2> /dev/null
-Find all files containing my IP address
compress -c file > file.Z    Compresses the files while keeps the original
whereis  <command-ame>    Returms full path of program
pax Command User to extract tar back to different location
Purpose
Extracts, writes, and lists members of archive files; copies files and directory hierarchies.
pax -rf /dev/rmt0 -s/u01/archive/p

Regaining root's password

Regaining root's password
 1) Boot from a cd-rom or a bootable Tape.
 2) Press F5 or 5.
 3) Select option 3 from installation and maintanance menu: Start maintanance menu for system recovery.
 4) Follow the option to activate the root vg and obtain the shell.
 5) Once a shell is available then run the passwd command to reset the password for root.
 6) sync
 7) Reboot the system.


AIX File Systems

# File Systems Types:
JFS, EJFS, NFS, CD-ROM File systems
# File Systems Structure:
Superblock: It contains control information about file systems such as a) Size of the file systems b) Name of the file systems c) The System log device d) The version number e) The number of inodes f) List of free inodes and data-bocks g) Date and time of creation of file system and also file system state.
IMP: Corruption of data may render the file system unusable. This is why system keeps a second copy of superblock on logical block 31.
Allocation Group: It consists of inodes and it corresponding data blocks. An allocation group spans multiple adjacent disk blocks and it improves the speed of i/o operation. Booth jfs and jfs2 file systems use allocation group.
Inodes: It contains control information about file such as a) Type, Size, Owner, and the date and time when the file was created, modified, last accessed. b) it also contains the pointers to data blocks that store the actual data of file. Every File has a corresponding inode. c) The jfs restricts all file systems to 16 MB inodes.
Data Blocks: It stores the actual data of the file or pointers to other data blocks. Default value for disk block size is 4 kb.
Fragments: Fragments of logical blocks can be used to support files smaller than the standard size of the logical block ( 4 kb ). This rule applies only to last block of a file smaller than 32 kb.
File Systems Differences
Function JFS JFS2
Architectural maximum file system size 1 TB 4 PB
Architectural maximum file size 64 GB 4 PB
No of inodes Fixed, set at Dynamic system creation
Inode size 128 bytes 512 bytes
Fragment size 512 512
Block size 4096 4096
Directory organization Linear B-tree
Compression Yes No
Default ownership at creation sys.sys root.system
SGID of default file mode SGID=on SGID=off

Example of file system creation
Creating file systems without specifying logical volumes
# lsvg -l testvg
testvg:LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
# crfs -v jfs -g testvg -a size=10M -m /fs1
Based on the parameters chosen, the new /fs1 JFS file systemis limited to a maximum size of 134217728 (512 byte blocks)New File System size is 262144
# crfs -v jfs2 -g testvg -a size=10M -p ro -m /fs2
File system created successfully.130864 kilobytes total disk space.New File System size is 262144
# lsvg -l testvg
testvg:LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINTloglv00 jfslog 1 1 1 closed/syncd N/Alv00 jfs 1 1 1 closed/syncd /fs1loglv01 jfs2log 1 1 1 closed/syncd N/Afslv00 jfs2 1 1 1 closed/syncd /fs2
# lslv lv00
LOGICAL VOLUME: lv00 VOLUME GROUP: testvgLV IDENTIFIER: 00c478de00004c0000000107d96de510.2 PERMISSION:read/writeVG STATE: active/complete LV STATE: closed/syncdTYPE: jfs WRITE VERIFY: offMAX LPs: 512 PP SIZE: 128 megabyte(s)COPIES: 1 SCHED POLICY: parallelLPs: 1 PPs: 1STALE PPs: 0 BB POLICY: relocatableINTER-POLICY: minimum RELOCATABLE: yesINTRA-POLICY: middle UPPER BOUND: 32MOUNT POINT: /fs1 LABEL: /fs1MIRROR WRITE CONSISTENCY: on/ACTIVEEACH LP COPY ON A SEPARATE PV ?: yesSerialize IO ?: NO
# lslv fslv00
LOGICAL VOLUME: fslv00 VOLUME GROUP: testvgLV IDENTIFIER: 00c478de00004c0000000107d96de510.4 PERMISSION:read/writeVG STATE: active/complete LV STATE: closed/syncdTYPE: jfs2 WRITE VERIFY: offMAX LPs: 512 PP SIZE: 128 megabyte(s)COPIES: 1 SCHED POLICY: parallelLPs: 1 PPs: 1STALE PPs: 0 BB POLICY: relocatableINTER-POLICY: minimum RELOCATABLE: yesINTRA-POLICY: middle UPPER BOUND: 32MOUNT POINT: /fs2 LABEL: /fs2MIRROR WRITE CONSISTENCY: on/ACTIVEEACH LP COPY ON A SEPARATE PV ?: yesSerialize IO ?: NO
# cat /etc/filesystemsgrep -ip fs1
/fs1:dev = /dev/lv00 vfs = jfslog = /dev/loglv00mount = falseaccount = false
# mount -a (Mount all the file systems)
# mount (Display mounted file systems)
# lsfs (Shows the characteristics of a file systems)
# rmfs (Removes the file systems)

Removing the file Systems
# rmfs /test
rmfs: 0506-921 /test is currently mounted.
# umount /test
# rmfs /test
rmlv: Logical volume testlv is removed.
# lsvg -l testvg
testvg:LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINTloglv00 jfslog 1 1 1 closed/syncd N/Alv00 jfs 1 1 1 closed/syncd /fs1loglv01 jfs2log 1 1 1 closed/syncd N/Afslv00 jfs2 1 1 1 closed/syncd /fs2
# cat /etc/filesystemsgrep test#

Changing the attributes of file systems
# chfs -a size=250M -p rw /fs2

Filesystem size changed to 524288
# fsck(Checks the Systems consistency and interactively repairs the file systems. Always run the fsck command on the mounted file systems.)
If First super block corrupted then how to recover
If you receive one of the following errors from the fsck or mount commands, the problem may be a corrupted superblock:
fsck: Not an AIX3 file systemfsck: Not an AIXV3 file systemfsck: Not an AIX4 file systemfsck: Not an AIXV4 file systemfsck: Not a recognized file system typemount: invalid argument
The problem can be resolved by restoring the backup of the superblock over the primary superblock using one of the following commands:
# dd count=1 bs=4k skip=31 seek=1 if=/dev/lv00 of=/dev/lv00

Not able to umount the file systems
Files are open within a file system. Close these files before the file system can be unmounted. The fuser command is often the best way to determine the process IDs for all processes that have open references within a specified file system. The process having an open reference can be killed by using the kill command and the unmount can be accomplished.
If the file system is still busy and not getting unmounted, this could be due to a kernel extension that is loaded, but exists within the source file system. The fuser command will not show these kinds of references, because a user process is not involved. However, the genkex command will report on all loaded kernel extensions.
# find /home -type d -exec fuser -u {} \;/home:/home/lost+found:/home/guest:/home/kenzie: 3548c(kenzie)

Determine 64 or 32 bit Unix Kernel and HW

Question: How to determine if I'm running 64 bit Unix Kernel ? Answer: User the following commands AIX getconf -a | grep KERN SOLARIS isainfo -vk HP-UX getconf KERNEL_BITS LINUX getconf LONG_BIT Question: How to determine if my Unix Hardware is 64 bit ? Answer: Use the following commands to determine the Hardware Architecture AIX bootinfo -y SOLARIS isainfo -vk HP-UX getconf HW_CPU_SUPP_BITS or getconf HW_32_64_CAPABLE If the above command returns 1, hardware supports both 32 and 64 bit binaries LINUX grep flags /proc/cpuinfo If the output of the above command contains the string "lm", Hardware is 64 bit. Example: flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc pni monitor ds_cpl est cid cx16 xtpr lahf_lm Note: 64 bit capable Hardware does not mean your OS is 64 bit. Generally, for backward compatibility, 64 bit capable Hardware can run 32 bit Software.

AIX Command Crib Sheet

AIX Command Crib Sheet ---------------------------------------------------------------------------- MISCELLENEOUS ---------------------------------------------------------------------------- oslevel Returns operating system level whence (program) Returns full path of program whereis (program) Returms full path of program what (program) Displays identifying info from the executable like version number, when compiled. lslpp -L all list all installed software lslpp -L (program set name) Check if software installed lslpp -f Lists filesets vs packages lslpp -ha Lists installation history of filesets instfix -ik (fix number eg IX66617) Checks id fix is installed instfix -ik 4330-02_AIX_ML compress -c file.txt > file.Z Create a compressed file. uuencode (infile) (extract-file-name) > (output file) Converts a binary file to an ASCII file for transfer by modem or email uudecode (encoded file) Extracts a binary file from encoded file and calls it the extract-file-name examples :- uuencode maymap maymap > maymap.enc uuencode maymap.enc od -c /tmp Displays contents of the /tmp directory file ls -i Lists files with their inode numbers echo * Lists files, can be used if ls is corrupt/missing alog -o -t boot View the boot log chtz (timezone eg GMT0BST) Changes the timezone in /etc/environment file chlang (language eg En_GB) Changes the language in /etc/environment file ar -v -t (archive file) List contents of an archive ar -v -x (archive file) Extracts the archive ar -v -t /usr/lib/libC-r.a Lists contents of the libC_r.a library find /source -print | cpio -pdm /target Copying directories using cpio, creates /target/source directory. dump -nTv (binary executable) Displays the contents of an executable file dump -c Displays string information dump -o Displays object file headers dump -l Displays line numbers dump -s Displays the text section snap -ao /dev/rmt0 Create a snapshot onto tape snap -ad (directory) Create a snapshot into a named directory other than the default (/tmp/ibmsupt) /usr/dt/bin/dtconfig -d Disables desktop logins /usr/dt/bin/dtconfig -e Enables desktop logins /var/dt/Xpid PID of the dtlogin process -------------------------------------------------------------------------------- TERMINALS -------------------------------------------------------------------------------- tty Displays what the tty/pty number of the terminal is. termdef reports the termtype setup in smit for the tty port that termdef is run on. chdev -l (device eg tty1) -a term=vt100 Sets tty to a vt100 terminal type penable tty0 adds getty line into /etc/inittab for tty0 and starts getty pdisable tty0 disables the getty line and disables getty penable / pdisable -a option is for all stty erase ^? Set backspace key for vt100 terminals stty erase ^H Set backspace key for wyse50 terminals lscons Displays the console device chcons -a login=enable (device eg /dev/tty1) Changes the console device Create ttys on ports 0 to 7 on adapter sa2 :- for i in 0 1 2 3 4 5 6 7 do mkdev -c tty1 -t tty -s rs232 -p sa2 -w$i -a login=enable -a term=vt100 done portmir -t /dev/tty0 Mirror current terminal onto /dev/tty0 portmir -o Turns off port mirroring -------------------------------------------------------------------------------- NETWORK -------------------------------------------------------------------------------- host (ip or hostname) Resolves a hostname / ip address hostname Displays hostname hostname (hostname) Sets the hostname until next reboot chdev -l (device name) -a hostname=(hostname) Changes hostname permanently chdev -l inet0 -a hostname=thomas ifconfig (device name) Displays network card settings ifconfig (device name) up Turns on network card ifconfig (device name) down Turns off network card ifconfig (device name) detach Removes the network card from the network interface list ifconfig en0 inet 194.35.52.1 netmask 255.255.255.0 up ifconfig lo0 alias 195.60.60.1 Create alias ip address for loopback route (add/delete) (-net/-host) (destination) (gateway) Adds or deletes routes to other networks or hosts, does not update the ODM database and will be lost at reboot. route add -net 194.60.89.0 194.60.90.4 lsattr -EHl inet0 Displays routes set in ODM and hostname odmget -q "name=inet0" CuAt Displays routes set in ODM and hostname refresh -s inetd Refresh inetd after changes to inetd.conf kill -1 (inetd PID) Refresh inetd after changes to inted.conf netstat -i Displays interface statistics entstat -d (ethernet adapter eg en0) Displays ethernet statistics arp -a Displays ip to mac address table from arp cache no -a Displays network options use -o to set individual options or -d to set individual options to default. no -o option=value (this value is reset at reboot) no -o "ipforwarding=1" traceroute (name or ipaddress) Displays all the hops from source to destination supplied. ping -R (name or ipaddress) Same as traceroute except repeats. -------------------------------------------------------------------------------- N.F.S. -------------------------------------------------------------------------------- exportfs Lists all exported filesystems exportfs -a Exports all fs's in /etc/exports file exportfs -u (filesystem) Un-exports a filesystem mknfs Configures and starts NFS services rmnfs Stops and un-configures NFS services mknfsexp -d /directory Creates an NFS export directory mknfsmnt Creates an NFS mount directory mount hostname:/filesystem /mount-point Mount an NFS filesystem nfso -a Display NFS Options nfso -o option=value Set an NFS Option nfso -o nfs_use_reserved_port=1 -------------------------------------------------------------------------------- BACKUPS -------------------------------------------------------------------------------- MKSYSB ------ mkszfile -f Creates /image.data file (4.x onwards) mkszfile -X Creates /fs.size file (3.x) mksysb (device eg /dev/rmt0) CPIO ARCHIVE ------------ find (filesystem) -print | cpio -ocv > (filename or device) eg find ./usr/ -print | cpio -ocv > /dev/rmt0 CPIO RESTORE ------------ cpio -ict < (filename or device) | more Lists archive cpio -icdv < (filename or device) cpio -icdv < (filename or device) ("files or directories to restore") eg cpio -icdv < /dev/rmt0 "tcpip/*" Restore directory and contents cpio -icdv < /dev/rmt0 "*resolve.conf" Restore a named file TAR ARCHIVE ----------- tar -cvf (filename or device) ("files or directories to archive") eg tar -cvf /dev/rmt0 "/usr/*" TAR RESTORE ----------- tar -tvf (filename or device) Lists archive tar -xvf (filename or device) Restore all tar -xvf (filename or device) ("files or directories to restore") use -p option for restoring with orginal permissions eg tar -xvf /dev/rmt0 "tcpip" Restore directory and contents tar -xvf /dev/rmt0 "tcpip/resolve.conf" Restore a named file AIX ARCHIVE ----------- find (filesystem) -print | backup -iqvf (filename or device) Backup by filename. eg find /usr/ -print | backup -iqvf /dev/rmt0 backup -(backup level 0 to 9) -f (filename or device) ("filesystem") Backup by inode. eg backup -0 -f /dev/rmt0 "/usr" -u option updates /etc/dumpdates file AIX RESTORE ----------- restore -qTvf (filename or device) Lists archive restore -qvxf (filename or device) Restores all restore -qvxf (filename or device) ("files or directories to restore") (use -d for restore directories) restore -qvxf /dev/rmt0.1 "./etc/passwd" Restore /etc/passwd file restore -s4 -qTvf /dev/rmt0.1 Lists contents of a mksysb tape BACKUPS ACROSS A NETWORK ------------------------ To run the backup on a local machine (cpio) and backup on the remote machine's (remhost) tape drive (/dev/rmt0) find /data -print | cpio -ocv | dd obs=32k | rsh remhost \ "dd ibs=32k obs=64k of=/dev/rmt0" To restore/read the backup (cpio) on the remote machine dd ibs=64k if=/dev/rmt0 | cpio -icvt To restore/read the backup (cpio) on the local machine from the remote machine's (remhost) tape drive (/dev/rmt0) rsh remhost "dd ibs=64k obs=32k if=/dev/rmt0" | dd ibs=32k \ | cpio -icvt To run the backup (cpio) on a remote machine (remhost) and backup to the local machines tape drive (/dev/rmt0) rsh remhost "find /data -print | cpio -icv | dd ibs=32k" \ | dd ibs=32k obs=64k of=/dev/rmt0 -------------------------------------------------------------------------------- Copying diskettes and tape -------------------------------------------------------------------------------- COPYING DISKETTES ----------------- dd if=/dev/fd0 of=(filename) bs=36b dd if=(filename) of=/dev/fd0 bs=36b conv=sync or flcopy COPYING TAPES ------------- dd if=/dev/rmt0 of=(filename) dd if=(filename) of=/dev/rmt0 or tcopy -------------------------------------------------------------------------------- VI Commands -------------------------------------------------------------------------------- :g/xxx/s//yyy/ global change where xxx is to be changed by yyy sed 's(ctrl v ctrl m)g//g' old.filename > new.filename Strips out ^M characters from ascii files that have been transferred as binary. To enter crontrol characters type ctrl v then ctrl ? where ? is whatever ctrl character you need. -------------------------------------------------------------------------------- DEVICES -------------------------------------------------------------------------------- lscfg lists all installed devices lscfg -v lists all installed devices in detail lscfg -vl (device name) lists device details bootinfo -b reports last device the system booted from bootinfo -k reports keyswitch position 1=secure, 2=service, 3=normal bootinfo -r reports amount of memory (/ by 1024) bootinfo -s (disk device) reports size of disk drive bootinfo -T reports type of machine ie rspc lsattr -El sys0 -a realmem reports amount of useable memory mknod (device) c (major no) (minor no) Creates a /dev/ device file. mknod /dev/null1 c 2 3 lsdev -C lists all customised devices ie installed lsdev -P lists all pre-defined devices ie supported lsdev -(C or P) -c (class) -t (type) -s (subtype) chdev -l (device) -a (attribute)=(new value) Change a device attribute chdev -l sys0 -a maxuproc=80 lsattr -EH -l (device) -D Lists the defaults in the pre-defined db lsattr -EH -l sys0 -a modelname rmdev -l (device) Change device state from available to defined rmdev -l (device) -d Delete the device rmdev -l (device) -SR S stops device, R unconfigures child devices lsresource -l (device) Displays bus resource attributes of a device. Power Management (PCI machines) ------------------------------- pmctrl -a Displays the Power Management state rmdev -l pmc0 Unconfigure Power Management mkdev -l pmc0 Configure Power Management -------------------------------------------------------------------------------- TAPE DRIVES -------------------------------------------------------------------------------- rmt0.x where x = A + B + C A = density 0 = high 4 = low B = retension 0 = no 2 = yes C = rewind 0 = no 1 = yes tctl -f (tape device) fsf (No) Skips forward (No) tape markers tctl -f (tape device) bsf (No) Skips back (No) tape markers tctl -f (tape device) rewind Rewind the tape tctl -f (tape device) offline Eject the tape tctl -f (tape device) status Show status of tape drive chdev -l rmt0 -a block_size=512 changes block size to 512 bytes (4mm = 1024, 8mm = variable but 1024 recommended) bootinfo -e answer of 1 = machine can boot from a tape drive answer of 0 = machine CANNOT boot from tape drive diag -c -d (tape device) Hardware reset a tape drive. tapechk (No of files) Checks Number of files on tape. < /dev/rmt0 Rewinds the tape !!! -------------------------------------------------------------------------------- PRINTERS / PRINT QUEUES -------------------------------------------------------------------------------- splp (device) Displays/changes printer driver settings splp /dev/lp0 export $LPDEST="pqname" Set default printer queue for login session lsvirprt Lists/changes virtual printer attributes. rmvirprt -q queuename -d queuedevice Removes a virtual printer qpri -#(job No) -a(new priority) Change a queue job priority. qhld -#(job No) Put a hold on hold qhld -r #(job No) Release a held job qchk -A Status of jobs in queues lpstat lpstat -p(queue) Status of jobs in a named queue qcan -x (job No) Cancel a job from a queue cancel (job No) enq -U -P(queue) Enable a queue enable (queue) enq -D -P(queue) Disable a queue disable (queue) qmov -m(new queue) -#(job No) Move a job to another queue startsrc -s qdaemon Start qdaemon sub-system lssrc -s qdaemon List status of qdaemon sub-system stop -s qdaemon Stop qdaemon sub-system -------------------------------------------------------------------------------- FILE SYSTEMS -------------------------------------------------------------------------------- Physical Volumes (PV's) ----------------------- lspv Lists all physical volumes (hard disks) lspv (pv) Lists the physical volume details lspv -l (pv) Lists the logical volumes on the physical volume lspv -p (pv) Lists the physical partition usage for that PV chdev -l (pv) -a pv=yes Makes a new hdisk a pysical volume. chpv -v r (pv) Removes a disk from the system. chpv -v a (pv) Adds the removed disk back into the system. chpv -a y (pv) Changes pv allocatable state to YES chpv -a n (pv) Changes pv allocatable state to NO migratepv (old pv) (new pv) Moves all LV's from one PV to another PV, both PV's must be in the same volume group. Volume Groups (VG's) -------------------- lsvg Lists all volume groups lsvg (vg) Lists the volume group details lsvg -l (vg) Lists all logical volumes in the volume group lsvg -p (vg) Lists all physical volumes in the volume group lsvg -o Lists all varied on volume groups varyonvg (vg) Vary On a volume group varyonvg -f (vg) Forces the varyon process varyonvg -s (vg) Vary on a VG in maintenance mode. LV commands can be used on VG, but LV,s cannot be opened for I/O. varyoffvg (vg) Vary Off a volume group synclvodm (vg) Tries to resync VGDA, LV control blocks and ODM. mkvg -y(vg) -s(PP size) (pv) Create a volume group mkvg -y datavg -s 4 hdisk1 reducevg -d (vg) (pv) Removes a volume group reducevg (vg) (PVID) Removes the PVID disk reference from the VGDA when a disk has vanished without the reducevg (vg) (pv) command being run first. extendvg (vg) (new pv) Adds another PV into a VG. exportvg (vg) Exports the volume group eg deletes it! Note : Cannot export a VG if it has active paging space, turn off paging, reboot before exporting VG. Exporting removes entries from filesystems file but does not remove the mount points. chvg -a y (vg) Auto Vary On a volume group at system start. lqueryvg -Atp (pv) Details volume group info for the hard disk. importvg -y (vg name) (pv) Import a volume group from a disk. importvg (pv) Same as above but VG will be called vg00 etc. chvg -Q (y/n) (vg name) Turns on/off Quorum checking on a vg. Logical Volumes (LV's) ---------------------- lslv (lv) Lists the logical volume details lslv -l (lv) Lists the physical volume which the LV is on mklv (vg) (No of PP's) (pv Name optional) Create a logical volume mklv -y (lv) (PP's) (pv name optional) Creates a named logical volume chlv -n (new lv) (old lv) Rename a logical volume extendlv (lv) (extra No of PP's) Increase the size of an LV rmlv (lv) Remove a logical volume mklv/extendlv -a = PP alocation policy -am = middle -ac = center -ae = edge -aie = inner edge -aim = inner middle migratepv -l (lv) (old pv) (new pv) Move a logical volume between physical volumes. Both physical volumes must be in the same volume group ! mklv -y (lv) -t jfslog (vg) (No of PP's) (pv Name optional) Creates a JFSlog logical volume. logform (/dev/lv) Initialises an LV for use as an JFSlog getlvcb -AT (lv) Displays Logical Volume Control Block information File Systems (FS's) ------------------- lsfs Lists all filesystems lsfs -q (fs) Lists the file system details mount Lists all the mounted filesystems mount (fs or lv) Mounts a named filesystem mount -a Mounts all filesystems mount all mount -r -v cdrfs /dev/cd0 /cdrom mounts cd0 drive over /cdrom crfs -v jfs -d(lv) -m(mount point) -A yes Will create a file system on the whole of the logical volume, adds entry into /etc/filesystems and will create mount point directory if it does not exist. crfs -v jfs -g(vg) -m(mount point) -a size=(size of fs) -A yes Will create a logical volume on the volume group and create the file system on the logical volume. All at the size stated. Will add entry into /etc/filesystems and will create the mount point directory if it does not exist. chfs -A yes (fs) Change file system to Auto mount in /etc/filesystems chfs -a size=(new fs size)(fs) Change file system size rmfs (fs) Removes the file system and will also remove the LV if there are no onther file systems on it. defrag -q (fs) Reports the fragment status of the file system. defragfs -r (fs) Runs in report only defrag mode (no action). defragfs (fs) Defragments a file system. fsck (fs) Verify a file system, the file system must be unmounted! fsck (-y or -n) (fs) Pre-answer questions either yes or no ! fsck -p (fs) Will restore primary superblock from backup copy if the superblock is corrupt. Mirroring --------- mklv -y (lv) -c(copies 2 or 3) (vg) (No of PP's) (PV Name optional) Creates a mirrored named logical volume. mklvcopy -s n (lv) (copies 2 or 3) (pv) Creates a copy of a logical volume onto another physical volume. The physical volume MUST be in the same volume group as the orginal logical volume ! rmlvcopy (lv) (copies 1 or 2) Removes logical volume copies. rmlvcopy (lv) (copies 1 or 2) (pv) From this pv only! syncvg -p (pv) Synchronize logical partion copies syncvg -l (lv) syncvg -v (vg) mirrorvg (vg) (pv) Mirrors the all the logical volumes in a volume group onto a new physical volume. New physical volume must already be part of the volume group. -------------------------------------------------------------------------------- BOOT LOGICAL VOLUME (BLV) -------------------------------------------------------------------------------- bootlist -m (normal or service) -o displays bootlist bootlist -m (normal or service) (list of devices) change bootlist bootinfo -b Identifies the bootable disk bootinfo -t Specifies type of boot bosboot -a -d (/dev/pv) Creates a complete boot image on a physical volume. mkboot -c -d (/dev/pv) Zero's out the boot records on the physical volume. savebase -d (/dev/pv) Saves customised ODM info onto the boot device. -------------------------------------------------------------------------------- SYSTEM DUMP -------------------------------------------------------------------------------- sysdumpdev -l Lists current dump destination. sysdumpdev -e Estimates dumpsize of the current system in bytes. sysdumpdev -L Displays information about the previous dump. sysdumpstart -p Starts a dump and writes to the primary dump device. sysdumpstart -s Starts a dump and writes to the secondary dump device. (MCA machine can also dump if key is in service position and the reset button is pressed) sysdumpdev -p (dump device) -P Sets the default dump device, permanently Analyse dump file :- echo "stat\n status\n t -m" | crash /var/adm/ras/vmcore.0 -------------------------------------------------------------------------------- PAGING SPACE (PS's) -------------------------------------------------------------------------------- lsps -a Lists out all paging space lsps -s Displays total paging and total useage lsps (ps) mkps -s(No of 4M blocks) -n -a (vg) mkps -s(No of 4M blocks) -n -a (vg) (pv) -n = don't activate/swapon now -a = activate/swapon at reboot chps -a n (ps) Turns off paging space. chps -s(No of 4M blocks) (ps) Increases paging space. chlv -n (new name) (old name) Change paging space name rmps (ps) Remove paging space. PS must have been turned off and then the system rebooted before it can be removed. Note : Need to change the swapon entry in /sbin/rc.boot script if you are changing the default paging space from /dev/hd6. You also need to do a "bosboot -a -d /dev/hdiskx" before the reboot. /etc/swapspaces File that lists all paging space devices that are activated/swapon during reboot. -------------------------------------------------------------------------------- SCHEDULING -------------------------------------------------------------------------------- crontab -l List out crontab entrys crontab -e Edit crontab entrys crontab -l > (filename) Output crontab entrys to a file crontab (filename) Enter a crontab from a file crontab -r Removes all crontab entrys crontab -v Displays crontab submission time. /var/adm/cron/cron.allow File containing users allowed crontab use. /var/adm/cron/cron.deny File containing users denied crontab use. /var/adm/cron/crontab Directory containing users crontab entries. at (now + 2 minutes, 13:05, etc) {return} Schedule a job using at Command or schell script {return} {CTRL D} at -l atq Lists out jobs scheduled to run via at command at -r (at job No) atrm (at job No) Removes an at job scheduled to run. /var/adm/cron/at.allow File containing users allowed at use. /var/adm/cron/at.deny File containing users denied at use. /var/adm/cron/atjobs Directory containing users at entries. -------------------------------------------------------------------------------- SECURITY -------------------------------------------------------------------------------- groups Lists out the groups that the user is a member of setgroups Shows user and process groups chmod abcd (filename) Changes files/directory permissions Where a is (4 SUID) + (2 SGID) + (1 SVTX) b is (4 read) + (2 write) + (1 execute) permissions for owner c is (4 read) + (2 write) + (1 execute) permissions for group d is (4 read) + (2 write) + (1 execute) permissions for others -rwxrwxrwx -rwxrwxrwx -rwxrwxrwx ||| ||| ||| - - - | | | Owner Group Others -rwSrwxrwx = SUID -rwxrwSrwx = SGID drwxrwxrwt = SVTX chown (new owner) (filename) Changes file/directory owners chgrp (new group) (filename) Changes file/directory groups chown (new owner).(new group) (filename) Do both !!! umask Displays umask settings umask abc Changes users umask settings where ( 7 - a = new file read permissions) ( 7 - b = new file write permissions) ( 7 - c = new file execute permissions) eg umask 022 = new file permissions of 755 = read write and execute for owner read ----- and execute for group read ----- and execute for other mrgpwd > file.txt Creates a standard password file in file.txt passwd Change current user password pwdadm (username) Change a users password pwdck -t ALL Verifies the correctness of local authentication lsgroup ALL Lists all groups on the system mkgroup (new group) Creates a group chgroup (attribute) (group) Change a group attribute rmgroup (group) Removes a group -------------------------------------------------------------------------------- USERS -------------------------------------------------------------------------------- passwd -f Change current users gecos (user description) passwd -s Change current users shell chfn (username) Changes users gecos chsh (username) (shell) Changes users shell env Displays values of environment variables printenv id Displays current user's uid and gid details id (user) Displays user uid and gid details whoami Displays current user details who am i (or who -m) who Displays details of all users currently logged in. w who -b Displays system reboot time uptime Displays number of users logged in, time since last reboot, and the machine load averages. lslicense Displays number of current user licensese chlicense -u (number) Changes the number of user licenses lsuser ALL Lists all users details lsuser (username) Lists details for user lsuser -a(attribute) (username or ALL) Lists user attributes lsuser -a home ALL mkuser -a(attributes) (newuser) Add a new user chuser (attributes) (user) Change a user chuser login=false (user) Lock a user account rmuser -p (user) Removes a user and all entries in security files usrck -t ALL Checks all the user entires are okay. fuser -u (logical volume) Displays processes using the files in that LV lsattr -D -l sys0 -a maxuproc Displays max number of processes per user chdev -l sys0 -a maxuproc=(number) Changes max number of processes per user -------------------------------------------------------------------------------- REMOTE USERS -------------------------------------------------------------------------------- ruser -a -f (user) Adds entry into /etc/ftpusers file ruser -a -p (host) Adds entry into /etc/host.lpd file ruser -a -r (host) Adds entry into /etc/hosts.equiv file ruser -d -f (user) Deletes entry in /etc/ftpusers file ruser -d -p (host) Deletes entry in /etc/host.lpd file ruser -d -r (host) Deletes entry in /etc/hosts.equiv file ruser -s -F Shows all entries in /etc/ftpusers file ruser -s -P Shows all entries in /etc/host.lpd file ruser -s -R Shows all entries in /etc/hosts.equiv file ruser -X -F Deletes all entries in /etc/ftpusers file ruser -X -P Deletes all entries in /etc/host.lpd file ruser -X -R Deletes all entries in /etc/hosts.equiv file -------------------------------------------------------------------------------- INITTAB -------------------------------------------------------------------------------- telinit S Switches to single user mode. telinit 2 Switches to multi user mode. telinit q Re-examines /etc/inittab lsitab -a Lists all entries in inittab lsitab (ident eg tty1) Lists the tty1 entry in inittab mkitab ("details") Creates a new inittab entry chitab ("details") Ammends an existing inittab entry rmitab (ident eg tty1) Removes an inittab entry. chitab "tty1:2:respawn:/usr/bin/getty /dev/tty1" -------------------------------------------------------------------------------- ODM -------------------------------------------------------------------------------- odmget -q "name=lp1" CuDv |more Gets lp1 info from pre-defined database. odmget -q "name-lp1" CuAt |more Gets lp1 info from customised database. odmdelete -o CuAt -q "name=lp1" Deletes lp1 info from customised db. odmget -q "name=lp1" CuAt > lp1.CuAt Export ODM info to text file. odmadd < lp1.CuAt Import ODM info from text file. -------------------------------------------------------------------------------- ERROR LOGGING -------------------------------------------------------------------------------- /usr/lib/errdemon -l Displays errorlog attributes. /usr/lib/errdemon Starts error logging. /usr/lib/errstop Stops error logging. errpt Displays summary errorlog report. errpt -a Displays detailed errorlog report. errpt -j (identifier) Displays singe errorlog report. Note : errorlog classes are H=Hardware S=Software O=Information V=Undetermined errclear (days) Deletes all error classes in the errorlog. errclear -d (class) (days) Deletes all error class entries in errlog. Note : The errclear command will delete all entries older than the numbers of days specified in the days paramenter. To delete ALL entries used 0. errlogger "message up to 230 chrs" Enters an operator notifaction message into the errorlog. -------------------------------------------------------------------------------- PERFORMANCE MONITORING -------------------------------------------------------------------------------- vmstat (drive) (interval) (count) Reports virtual memory statistics. vmstat hdisk0 5 20 vmstat -s Diplays number of paging events since system start. vmstat -f Diplays number of forks since system start. vmstat -i Diplays number of interupts by device since system start. iostat (drive) (interval) (count) Reports i/o and cpu statistics. iostat hdisk0 5 20 iostat -d (drive) (interval) (count) Limits report to drive statistics. iostat -t (interval) (count) Limits report to tty statistics. sar -u -P ALL 10 10 Displays %usr %sys %wio %idle for all processors -------------------------------------------------------------------------------- DOS DISKETTES -------------------------------------------------------------------------------- dosdir Reads directory listing of a diskette dosdir (directory) Reads directory listing of a named directory dosread -D/dev/fd0 C41.TXT c41.txt Gets C41.TXT from diskette drive fd0 dosread -D/dev/fd0 DIRECTORY/C41.TXT c41.txt (-D option can be dropped if using fd0) doswrite -D/dev/fd0 (unixfile) (dosfile) Writes a file to diskette dosdel (dosfile) Deletes a dos file on diskette dosformat Formats the diskette -------------------------------------------------------------------------------- SENDMAIL -------------------------------------------------------------------------------- sendmail -bi Creates new aliase db from /etc/aliase file. newaliases sendmail -bp Displays the contents of the mail queue mailq sendmail -q Processe the sendmail queue NOW sendmail -bt -d0.4 < /dev/null Prints out sendmail version, compile defines and system information refresh -s sendmail Restart sendmail kill -l (sendmail PID) -------------------------------------------------------------------------------- SP / PSSP -------------------------------------------------------------------------------- dsh (command) Runs the command on all the nodes Efence Diplays which node are currently fenced Efence (node number) Fences the node Eunfence (node number) Unfences the node Estart Starts the switch spmon -q Starts SP monitor in gui spmon -d -G Diag info, lists LED and switch info for all nodes spmon -L frame1/node3 Displays LED for node 3 in frame 1 spmon -p off frame1/node3 Powers off the node spmon -p on frame1/node3 Powers on the node spled Diplays all the nodes LED's in a updating gui s1term -w (frame number) (node number) Opens serial terminal (read and write) s1term (frame number) (node number) Opens serial terminal (read only) Example :- s1term 1 1 Opens a serial terminal to console port on frame 1 node 1 which is read only. When rebooting a node use read only. splstdata -e Lists site environment database information -d Displays df command from each node -n Lists node configuration -h Diplays lscfg command from each node -s Lists switch node information -b Lists boot/installation information -a Lists LAN database information -i Displays netstat -in command from each node