This site has been destroyed by Google forced upgrade to new way of WEB site.
All files links are not working. Many images has been lost in conversation.
Have to edit 190 pages manually. Will try to do ASAP but for this I need time ...
THANK YOU GOOGLE !

Thursday, November 26, 2020

Check file space script for any Unix

we DBAs have problems when need to check space on different Unix envs (HP-UX, AIX, Linux, Solaris etc). Here is a script that covers all envs... and I use it with great success:
df -Pk | awk '{ 
 if ( NR == 1 ) { next } 
 if ( NF == 6 ) { print } 
 if ( NF == 5 ) { next } 
 if ( NF == 1 ) { 
 getline record; 
 $0 = $0 record 
 print $0 
 } 
 }' | awk '
BEGIN {print "Filesystem                                    Mount Point                                     Total GB   Avail GB    Used GB  Used"
       print "--------------------------------------------- --------------------------------------------- ---------- ---------- ---------- -----"}
END {print ""}
/dev/ || /^[0-9a-zA-Z.]*:\// {
printf ("%-45.45s %-45s %10.2f %10.2f %10.2f %4.0f%\n",$1,$6,$2/1024/1024,$4/1024/1024,$3/1024/1024,$5)
}'
Result (from one Linux server) looks like:
Filesystem                                    Mount Point                                     Total GB   Avail GB    Used GB  Used
--------------------------------------------- --------------------------------------------- ---------- ---------- ---------- -----
devtmpfs                                      /dev                                              377.67     377.67       0.00    0%
tmpfs                                         /dev/shm                                          377.68     377.61       0.08    1%
/dev/mapper/SYSTEM-ROOT                       /                                                   1.91       1.69       0.10    6%
/dev/mapper/SYSTEM-USR                        /usr                                                3.81       1.88       1.71   48%
/dev/mapper/SYSTEM-SRV                        /srv                                                0.48       0.44       0.00    1%
/dev/sda2                                     /boot                                               0.48       0.21       0.23   52%
/dev/mapper/SYSTEM-HOME                       /home                                               0.95       0.88       0.01    1%
/dev/mapper/SYSTEM-HOMEU_USER                 /home/uisupp                                        1.91       1.78       0.01    1%
/dev/sda1                                     /boot/efi                                           0.24       0.23       0.01    4%
/dev/mapper/SYSTEM-OPT                        /opt                                                4.89       3.02       1.65   36%
/dev/mapper/SYSTEM-TMP                        /tmp                                                5.78       5.43       0.04    1%
/dev/mapper/SYSTEM-VAR                        /var                                                3.87       3.41       0.26    8%
/dev/mapper/SYSTEM-VARLIB                     /var/lib                                            0.95       0.52       0.37   42%
/dev/mapper/SYSTEM-VARLOG                     /var/log                                            3.81       3.21       0.39   11%
/dev/mapper/SYSTEM-VARCACHE                   /var/cache                                          4.86       4.05       0.57   13%
/dev/mapper/SYSTEM-ORABASE                    /orabase                                           39.25       9.43      27.80   75%
srvrv001.srvr.com:/srvr_db_new                /var/backup                                      7168.00    7131.84      36.16    1%
/dev/mapper/SRVR10T-AUDIT                     /db/audit/SRVR10T                                   9.72       9.30       0.20    3%
/dev/mapper/SRVR10T-ADMIN                     /db/admin/SRVR10T                                  39.25      36.22       2.21    6%
/dev/mapper/SRVR10T-REDOA                     /db/redoa/SRVR10T                                   9.72       5.44       4.06   43%
/dev/mapper/SRVR10T-REDOB                     /db/redob/SRVR10T                                   9.72       5.44       4.06   43%
/dev/mapper/SRVR10T-FLASHARCH                 /db/flasharch/SRVR10T                              98.31      96.23       0.06    1%
/dev/mapper/SRVR10T-DBF01                     /db/dbf/SRVR10T                                   344.38       0.00     338.84  100%
123.45.67.890:/transfer                       /mnt/transfer                                    2918.40    2673.66     244.74    9%

Hope this helps.

Cheers!

No comments :

Post a Comment

Zagreb u srcu!

Copyright © 2009-2018 Damir Vadas

All rights reserved.


Sign by Danasoft - Get Your Sign