Linux and Unix Tips
Tuesday, January 8, 2013
Steps To Add Swap Space In AIX
1) Run lsps -a command to retrieve all the swap space in the system.
#lsps -a
Page Space Physical Volume Volume Group Size %Used Active Auto Type Chksum
hd6 hdisk2 rootvg 4608MB 81 yes yes lv 0
#
2) Run prtconf and look for hdisk2 physical volume. From below we noticed that there are free PPs so we are able to add more swap space.
#prtconf
←-- snipped ---->
=====================================================================
rootvg:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk2 active 639 172 35..00..00..09..128
hdisk3 active 639 172 35..00..00..09..128
=====================================================================
←-- snipped ---->
3) To check more details on rootvg volume group follow this:
#lsvg rootvg
VOLUME GROUP: rootvg VG IDENTIFIER: 00f619aa00004c0000000131f69ac173
VG STATE: active PP SIZE: 32 megabyte(s)
VG PERMISSION: read/write TOTAL PPs: 1278 (40896 megabytes)
MAX LVs: 256 FREE PPs: 344 (11008 megabytes)
LVs: 11 USED PPs: 934 (29888 megabytes)
OPEN LVs: 10 QUORUM: 1 (Disabled)
TOTAL PVs: 2 VG DESCRIPTORS: 3
STALE PVs: 0 STALE PPs: 0
ACTIVE PVs: 2 AUTO ON: no
MAX PPs per VG: 32512
MAX PPs per PV: 1016 MAX PVs: 32
LTG size (Dynamic): 256 kilobyte(s) AUTO SYNC: no
HOT SPARE: no BB POLICY: relocatable
PV RESTRICTION: none INFINITE RETRY: no
4) To add 250MB swap space you need to add 8 PPs(8 x 32MB).
# mkps -a -n -s 8 rootvg
paging00
#
5)Verify the newly added paging space:
#cat /etc/swapspaces
* /etc/swapspaces
*
* This file lists all the paging spaces that are automatically put into
* service on each system restart (the 'swapon -a' command executed from
* /etc/rc swaps on every device listed here).
*
* WARNING: Only paging space devices should be listed here.
*
* This file is modified by the chps, mkps and rmps commands and referenced
* by the lsps and swapon commands.
hd6:
dev = /dev/hd6
auto = yes
checksum_size = 0
paging00:
dev = /dev/paging00
Check the status using lsps command.
#lsps -a
Page Space Physical Volume Volume Group Size %Used Active Auto Type Chksum
hd6 hdisk2 rootvg 4608MB 78 yes yes lv 0
paging00 hdisk2 rootvg 250MB 0 yes yes lv 0
#
Now to remove the paging space, we need to use the below commands.
# swapoff /dev/paging00
#
# rmps paging00
rmlv: Logical volume paging00 is removed.
#
#lsps -a
Page Space Physical Volume Volume Group Size %Used Active Auto Type Chksum
hd6 hdisk2 rootvg 4608MB 78 yes yes lv 0#
Thursday, January 3, 2013
ksh: 0403-030 The fork function failed. Too many processes already exist.
ksh: 0403-030 The fork function failed. Too many processes already exist.
Steps to resolve the above issue:
1) Check the process and look for defunct processes and owner of the process.
Defunct process is zombie process and do not take much resources but in this cases caused too many files exist for the particular user which generate the above error. We have to kill this processes in order to release it. The only way is to kill the parent processes for that particular owner. Reboot help too but we can avoid it.
2) Communicate with the user and retrieve all the parent processes that running under this owner. Request permission to kill all the process in order to release all the defunct processes.
Wednesday, January 2, 2013
Linux Rename Eth0/Eth1 Network Interface Card Name [ Udev ]
We can use udev to change these settings.
Step #1: Find out the MAC address of the Ethernet device
Type the following command:
# ifconfig -a | grep -i --color hwaddr
Sample outputs:
#ifconfig -a | grep -i --color hwaddr
eth1 Link encap:Ethernet HWaddr 00:0C:29:CD:5A:7F
virbr0 Link encap:Ethernet HWaddr 52:54:00:7F:E6:58
virbr0-nic Link encap:Ethernet HWaddr 52:54:00:7F:E6:58
Note down the MAC address.
Step #2: Rename eth0 as wan0
To rename eth0 as wan0, edit a file called 70-persistent-net.rules in /etc/udev/rules.d/ directory, enter:
# vi /etc/udev/rules.d/70-persistent-net.rules
The names of the Ethernet devices are listed in this file as follows:
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:cd:5a:7f", ATTR{type}=="1", KERNEL=="eth*", NAME
="eth1"
Locate and identify the line with the NIC from step 1 (look for the MAC address). It may look like above. In this example, the interface eth1 will be renamed to wan0 (change NAME="eth1" to NAME="wan0"):
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:cd:5a:7f", ATTR{type}=="1", KERNEL=="eth*", NAME
="wan0"
Save and close the file. Reboot the system to test changes:
# reboot
Verify new settings:
# ifconfig -a
# ifconfig wan0
Friday, December 21, 2012
Automation - System Administration.
System administrator writes scripts that the system can execute at a particular time each day,week or month. Tasks that are common and often repeated,tedious are best performed through automation. Two question came in our mind when think about automation which are "What can be automated?" and "What should be automated?". Following are few tasks that can be performed through automation.
1) Adding new users
2) Process monitoring
3) File search and removal.
4) Configuration changes on servers.
5) Getting servers information.( Big environment)
6) Software Installation.
7) Remote administration tasks.
The above tasks can be performed by writing scripts. Scripts are program that can interact with the operating system using OS commands.There are many scripting language that can be used to write scripts like shell(Korn,bash),Perl,Python and others.
Tasks can be automated with cron services where we can execute certain scripts at a particular time,day,week or month.
1) Adding new users
2) Process monitoring
3) File search and removal.
4) Configuration changes on servers.
5) Getting servers information.( Big environment)
6) Software Installation.
7) Remote administration tasks.
The above tasks can be performed by writing scripts. Scripts are program that can interact with the operating system using OS commands.There are many scripting language that can be used to write scripts like shell(Korn,bash),Perl,Python and others.
Tasks can be automated with cron services where we can execute certain scripts at a particular time,day,week or month.
Tuesday, December 18, 2012
5 Useful Linux Touch command
1) Create an empty file
Below will create 0 bytes file called 'test123'. It will change the modification/access timestamp.
#touch test123
Touch -c avoid creating non-existence file.
2)Create new file's timestamp
#touch -t 05070915 test123
3)Change modification time
# touch -m test123
4) Change access time
# touch -a test123
5)Copy other file's timestamp.
#touch try123 -r test123
Below will create 0 bytes file called 'test123'. It will change the modification/access timestamp.
#touch test123
Touch -c avoid creating non-existence file.
2)Create new file's timestamp
#touch -t 05070915 test123
3)Change modification time
# touch -m test123
4) Change access time
# touch -a test123
5)Copy other file's timestamp.
#touch try123 -r test123
Friday, June 15, 2012
$PATH
To export
export PATH=$PATH:/home/velayuts/Desktop
To delete
del=':/home/velayuts/Desktop';export PATH="${PATH//$del}"
export PATH=$PATH:/home/velayuts/Desktop
To delete
del=':/home/velayuts/Desktop';export PATH="${PATH//$del}"
Tuesday, November 22, 2011
SSH Trust:SSHv2 to SSHv2
Steps To configure as follows:
FSecure SSH v2 --> FSecure SSH v2Case Study: ssh trust for user kumar from Sun to Moon
1) sun:-->ssh-keygen2 -t dsa (Key will be generated at user's home - /home/kumar/.ssh2)
2) sun:/home/kumar/.ssh2-->cp id_dsa_1024_sun_a kumar@sun. (This step is done to give some useful name and to avoid confusion.)
3) sun:/home/kumar/.ssh2-->cp id_dsa_1024_sun_a.pub kumar@sun.pub (This step is done to give some useful name and to avoid confusion.)
4) sun:/home/kumar/.ssh2-->echo 'IdKey kumar@sun' > identification ('Identification' file will be created)
5) Copy kumar@sun.pub to remote host's(moon) /export/home/kumar/.ssh
6) moon#:/home/kumar/.ssh2-->echo 'Key mathamsv@oktstcl1.okla.seagate.com.pub' > authorization
7)Done.Now user 'kumar' can ssh without password from Sun to Moon.
FSecure SSH v2 --> FSecure SSH v2Case Study: ssh trust for user kumar from Sun to Moon
1) sun:-->ssh-keygen2 -t dsa (Key will be generated at user's home - /home/kumar/.ssh2)
2) sun:/home/kumar/.ssh2-->cp id_dsa_1024_sun_a kumar@sun. (This step is done to give some useful name and to avoid confusion.)
3) sun:/home/kumar/.ssh2-->cp id_dsa_1024_sun_a.pub kumar@sun.pub (This step is done to give some useful name and to avoid confusion.)
4) sun:/home/kumar/.ssh2-->echo 'IdKey kumar@sun' > identification ('Identification' file will be created)
5) Copy kumar@sun.pub to remote host's(moon) /export/home/kumar/.ssh
6) moon#:/home/kumar/.ssh2-->echo 'Key mathamsv@oktstcl1.okla.seagate.com.pub' > authorization
7)Done.Now user 'kumar' can ssh without password from Sun to Moon.
Subscribe to:
Posts (Atom)