If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > to check available space

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-18-04, 12:58
saccskiz saccskiz is offline
Registered User
 
Join Date: Feb 2004
Posts: 143
to check available space

Hi,
I am doing an oracle export of a schema from a database. The .dmp file that will be generated is going to be about 10mb in size. I am doing this from a folder called /home/biolink(which is where the .dmp export file will be created)
My question is before I do this, how can I make sure if /home/biolink has the necessary space so that the export is going to be successful. I needed to know what I can do to check how much is used, how much more space is there. I just didn't want to run out of space. My OS is AIX 5.1.
thank you
Reply With Quote
  #2 (permalink)  
Old 03-18-04, 17:06
ika ika is offline
Registered User
 
Join Date: Oct 2003
Location: Slovakia
Posts: 482
Re: to check available space

Quote:
Originally posted by saccskiz
Hi,
I am doing an oracle export of a schema from a database. The .dmp file that will be generated is going to be about 10mb in size. I am doing this from a folder called /home/biolink(which is where the .dmp export file will be created)
My question is before I do this, how can I make sure if /home/biolink has the necessary space so that the export is going to be successful. I needed to know what I can do to check how much is used, how much more space is there. I just didn't want to run out of space. My OS is AIX 5.1.
thank you

df -k
Reply With Quote
  #3 (permalink)  
Old 03-18-04, 17:29
saccskiz saccskiz is offline
Registered User
 
Join Date: Feb 2004
Posts: 143
Re: to check available space

Hi,
I tried df -k
I got the following values --
For column
Filesystem -- > /dev/dephome_rn
1024 - blocks --> 2555904
Free --> 152040
%Used --> 95%
Iused --> 13707
%Iused --> 3%
Mounted on --> /home/biolink

Does this mean that the freespace available is 152.040 mb ? Also what does Iused and %Iused mean?

Thanks
Reply With Quote
  #4 (permalink)  
Old 03-19-04, 05:28
aigles aigles is offline
Registered User
 
Join Date: Jan 2004
Location: Bordeaux, France
Posts: 319
In your example the free space is 152040 Kb = 148.47 Mb (1Mb = 1024 Kb)

Iused and %Iused are number and % of Inodes used.

You can use this script to verify space :
Code:
#
# Usage: $0 required_space [filesystem]
# required_space = nnn[unit]  unit=Bytes, Kilo, Mega, Giga
# filesystem, default ='.'

: ${1:?'You must specify required free space'}

df -k ${2:-.} | tail -1 | \
awk -v Required=$1 '
BEGIN {
   Required = toupper(Required);
   if (Required !~ /^[0-9]+(\.[0-9]*)?[BKMG]?$/) {
      print "Invalid value for required free space: " Required;
      exit 1;
   }
   if (Required ~ /[BKMG]$/) {
      len = length(Required);
      unit = substr(Required,len,1);
      Required = substr(Required,1,len-1);
   } else {
      unit = "B";
   }
   if      (unit == "G")
        Required = Required * 1024 * 1024;
   }
   if      (unit == "G")
        Required = Required * 1024 * 1024;
   else if (unit == "M")
        Required = Required * 1024;
   else if (unit == "B")
        Required = (Required + 1023) / 1024;
   Required = int(Required + .999);

   print "Required free space : " Required " K";
}
{
   Free = $4;
   print "Free space : " Free "K";
   if (Free > Required) {
      print "\nRequired free space available";
      exit;
   } else {
      print "\nNot enought free space available" ;
      exit 1;
   }
}
'
__________________
Jean-Pierre.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On