Sunday, 11 January 2015

Not enough free space to shrink the file system issue in AIX

Recently got an issue in reducing jfs2 filesystem  with osverion 6.1 and have enough space to reduce filesystem.
root@umaix /tmp>df -g /orafs1
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/oralv1   100.00    75.00   25%      555     1%  /orafs1

root@umaix /tmp>chfs -a size=-15G /orafs1
chfs: There is not enough free space to shrink the file system.
This issue will occur whenever you try to reduce big chunk of data ( in this case 15GB) that may not be contiguous in the file-system because you have files scatted everywhere.

Try   the following methods one by one until your issue fixed

1. Try to defrag the FS:

#defragfs -s /orafs1

2. Reduce in smaller chunks:

If you still can't reduce it after this. Try reducing the filesystem  in smaller chunks. Instead of 15G at a time, try reducing 1 or 2 gigs. Then, repeat the operation.

3. Check the processes:

Sometimes processes open big files and use lots of temporary space in those filesystem.
You could check processes/applications running against the filesystem and stop them temporarily, if you can.
#fuser -cu[x] <filsystem>

4. Move the large files and try shrink

Try looking for files large using the find cmd and move them out temporarily, just to see if we can shrink the fs without them:
#find /<filesystem> -xdev -size +2048 -ls|sort -r +10|pg

Finally the last method, the alternative approach if any one of above methods are not working then go for filesystem recreation.

==> You should be very care full , need to take fs backup and as well as approach application before removing the filelsystem.

5) Recreate filesystem:

  • - Take databackup of the fielsystem  ( very Important,dont skip this )
  •   Either you can take using your backup tools like TSM / netbackup or move data to a temporary   directory

  • - Remove the  filesystem  (  #rmfs /orafs)
  • - Create the filesystem again
  •    #mklv -y oralv1 -t jfs2 oravg 600  ( in this case we need 75GB and pp size is 128)
       #crfs -v jfs2 -d oralv1 -m /orafs1 -A yes  (create orafs1 filesystem)

  • - Restore data to the filesystem
  • - Verify fs size

  • root@umaix /tmp>df -g /orafs1
    Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
    /dev/oralv1   75.00    50.00   33%      555     1%  /orafs1

Wednesday, 7 January 2015

How to mirror VIOS Boot Disk?

Here is the procedure to mirror VIOs boot disk.
# lspv
NAME             PVID                 VG               STATUS
hdisk0           00c122d4341c6e62     rootvg           active
hdisk1           00cd55a4fg6b676f     None
hdisk2           00c5524409a99b77     None
Here hdisk0 is rootvg disk , now we need to check free disk.
you can use lspv -free command to check the un-mapped free disks.
$ lspv -free
NAME            PVID                                SIZE(megabytes)
hdisk1         00cd55a4fg6b676f                     256000
hdisk2         00c5524409a99b77                     256000
So In this case, hdisk1 is free and un-mapped . So we're going to use hdisk1 to mirror with hdisk0.

Add hdisk1 into rootvg:
# extendvg rootvg hdisk1 0516-1254 extendvg: Changing the PVID in the ODM.
Now mirror the disk but defer the automatic reboot:
$ mirrorios -defer hdisk1
Now check the boot list:
$ bootlist -mode normal -ls
hdisk0 blv=hd5 pathid=0
We only have hdisk0 at the moment.  Need to add hdisk1 into this:
$ bootlist -mode normal hdisk0 hdisk1
Check that worked:
$ bootlist -mode normal -ls
hdisk0 blv=hd5 pathid=0
hdisk1 blv=hd5 pathid=0
You now have a mirrored rootvg. 

Thursday, 1 January 2015

Happy New Year 2015

Wish you very very happy new year to you all and your family members. I hope this new year give a good health and prosperity to you .

Thanks for all your support  for the past 20 months.We promise you , will publish more and more promising posts in this new year.

Once again happy new year ..!

Unix Mantra

Thursday, 18 December 2014

Tar Files extraction Unix / Linux

Q: How can I extract  specific file from a tar ball ?

Tar or Tar ball is a single file  bundled with files &/ directories. First  we will discuss about general extraction of a files from tar ball.

Unpack or extract a tar file :

To unpack or extract a tar file, type:
tar -xvf myfile.tar
some times to save more space and bandwidth , we  need compress the tar balls using compression techniques like gzip or bzip2.

To unzip and extract  those tar files, type as below 
For  .tar.gz files 
tar -xzvf myfile.tar.gz

For .tar.bz2
tar -xjvf myfile.tar.bz2
-x : Extract a tar ball.
-v : Verbose output or show progress while extracting files.
-f : Specify an archive or a tarball filename.
-j : Decompress and extract the contents of the compressed archive created by bzip2 program (tar.bz2 extension).
-z : Decompress and extract the contents of the compressed archive created by gzip program (tar.gz extension).
Now here comes our main purpose ,  to extract a specific file  from a tar file.

Extract Specific file from a tar ball:

To extract a single file called myfile1.txt, enter:
tar -xvf file.tar myfile1.txt
tar -xzvf file.tar.gz myfile1.txt
tar -xjvf file.tar.bz2 myfile1.txt
You can also specify path such as home/um/myfile2.txt, enter:
tar -xvf file.tar home/um/myfile2.txt
tar -xzvf file.tar.gz home/um/myfile2.txt
tar -xjvf file.tar.bz2 home/um/myfile2.txt

How to Extract a Single Directory?

To extract a single directory called /home/um, enter:
tar -xvf file.tar home/um
tar -xzvf file.tar.gz home/um
tar -xjvf file.tar.bz2 home/um

Sample O/P:

Wednesday, 17 December 2014

MobaXterm free Xserver and SSH client

Recently when I am browsing internet  for Unix connectivity tools I came across a wonderful tool called MobaXterm. As per the MobaXterm team  its "an enhanced terminal for Windows with an X11 server, a tabbed SSH client and several other network tools for remote computing (VNC, RDP, telnet, rlogin). MobaXterm brings all the essential UNIX commands to Windows desktop, in a single portable exe file which works out of the box".

Downaload:There are two different versions available, one is free version and other is Pro.
I think free version is good enough to accommodate our daily tasks. If you still  feel you need  more then  go for Pro.

Download Link

The following are  the key features mentioned by them.

Key Features:
  • Free X server fully configured (based on Xorg)
  • Tabbed terminal based on PuTTY / MinTTY with antialiased fonts and macro support
  • Easy DISPLAY exportation from any remote host
  • X11-Forwarding capability in OpenSSH
  • Several Unix/Linux commands based on Cygwin (rsync, wget, sed, awk, grep, cd, ls, cat, cp, ...)
  • A session manager with all the network clients you need: RDP, VNC, SSH, telnet, rsh, FTP, SFTP and XDMCP
  • Program without installation that you can start from an USB stick
  • Light and portable application, packaged in a single executable

I am really enthralled by the features its offering.Here are few snippets.

1) Inbuilt Unix Command Support :
When you open MobaXterm  it will automatically  open session which supports many of Unix/Linux based commands  (ls, cd, grep, awk, tail, cut, sed, wget, rsync, telnet, ssh, rlogin, rsh etc ) based on Cygwin. You can further add packages using this link plugins.

2)Tabbed Sessions:
When ever you open a session , it will be open as tabbed session, just like Putty Connection Manager.
You can also save your session along with usernames and passwords

The SSH connection configured with automatic X-11 forwarding.You can use this as fully configured "X server " and also supports OpenGL.

4) Automatic SFTP Support:
A SFTP session is automatically opened when you open a ssh session on leftside. You can  download or upload files directly with a drag and drop from/to the remote server.You  can also  edit And save the files with one click open it in MobiXeditor or  which ever the text editor on your system.

5) Remote Windows Connections using RDP: 
  You can access the remote windows machines using RDP adding as connection.

6) Split-mode Terminal:
you can display up to 4 terminals at the same time in the main window. It is very useful for monitoring 4 remote computers or for comparing outputs of 2 terminals.

7) Multiple Sessions Support:
It will support various session types like SSH,RSH,Telnet,Xdmcp,RDP,VNC, SFTP,FTP many more.

8) Muti Execution Mode:
There us a facility just klike PuttyCM, You can run one single command in all the open sessions.But be more cautious when you are using this facility, need to be careful on which sessions you are running this.

There are lot more features and further information you can refer the following link.
more features link

Saturday, 15 November 2014

Manually Installing PHP in Linux

Before installing php,  we need to install apache.The most recent version of Apache HTTP Server may be obtained from >> Apache Download.

1) Download  & Unpack Apache HTTP server Package:

Download and unpack Apache http server package  from the location listed above, and unpack it.
Download Link: Apache Download
gzip -d httpd-2_x_NN.tar.gz
tar -xf httpd-2_x_NN.tar

2) Download  & Unpack PHP source Package:

Download Link: PHP Dowanlod
gunzip php-NN.tar.gz
tar -xf php-NN.tar

3) Build and install Apache:

cd httpd-2_x_NN
./configure --enable-so
make install

4) Start  & Start Apache:

/usr/local/apache2/bin/apachectl start
stop the  apache to configure php
/usr/local/apache2/bin/apachectl stop

5) Configure & Build  PHP Package:

cd ../php-NN
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
make install

6)Setup your php.ini

cp php.ini-development /usr/local/lib/php.ini
You may edit your .ini file to set PHP options. If you prefer having php.ini in another location, use --with-config-file-path=/some/path in step 5.

If you instead choose php.ini-production, be certain to read the list of changes within, as they affect how PHP behaves.

7) Edit your httpd.conf to load the PHP module:

LoadModule php5_module modules/

8) Tell Apache to  parse PHP extensions:

If you instead choose php.ini-production, be certain to read the list of changes within, as they affect how PHP behaves.
let's have Apache parse .php files as PHP. Add to httpd.conf file.
<FilesMatch \.php$>
    SetHandler application/x-httpd-php
Or, if we wanted to allow .php, .php2, .php3, .php4, .php5, .php6, and .phtml files to be executed as PHP, but nothing else, we'd use this:
FilesMatch "\.ph(p[2-6]?|tml)$">
    SetHandler application/x-httpd-php
And to allow .phps files to be handled by the php source filter, and displayed as syntax-highlighted source code, use this:
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source

9) Start Apache:

/usr/local/apache2/bin/apachectl start
service httpd restart
That’s all.