Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

checking available room on remote machine

Posted on 2006-11-06
5
Medium Priority
?
213 Views
Last Modified: 2010-04-20

Hello group,

In a bash script, what is the best way of calculating a directory path such /aDir/Backups/.

What I mean is I need to know finding out the available room under this directory.

Thanks,
ak

0
Comment
Question by:akohan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 10

Accepted Solution

by:
Luxana earned 750 total points
ID: 17886698
Hi


one way can be:

cd /aDir/Backups

df -h .

to see disk usage by directories in /aDir/Backups you can do

du -sh /aDir/Backups


lubo
0
 

Author Comment

by:akohan
ID: 17886966


thank you I have still a question. What you said works but why when I run:

$ df  

comparing to

$ df /usr/local

I get same number as available room? I thought that they should be different since every directory has assigned a percentage of the while size of hard drive.

Any comment?


0
 
LVL 10

Expert Comment

by:Luxana
ID: 17887043
Any comment?

1) df takes percentage(used memory)
EXAMPLE:

myfolder is in /var/myfolder and my partition /hda3 is mounted to /var
I get different results when I do df -h / and df -h /var

if you type just df -h you should see all partitons you have. In my case it is:
REAL EXMAPLE: :-)

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda2             897M  117M  733M  14% /
tmpfs                 253M     0  253M   0% /dev/shm
/dev/hda8              19G   49M   18G   1% /home
/dev/hda3              14G  175M   13G   2% /tmp
/dev/hda6             3.7G  360M  3.2G  11% /usr
/dev/hda7             1.8G   11M  1.7G   1% /usr/local
/dev/hda5              14G  535M   13G   4% /var
/dev/md0               74G  8.5G   62G  13% /srv

df -h /var/www/
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda5              14G  535M   13G   4% /var


2) why grade B if that worked?


lubo
0
 

Author Comment

by:akohan
ID: 17887966

So there is no way to get how much space is left under a specific directory such /usr/local ?

Sorry about B since I got the results but no details I found then. No worries next time I will make it up.
I'm a newbie so lot of question will be here.
0
 
LVL 10

Expert Comment

by:Luxana
ID: 17893249
>So there is no way to get how much space is left under a specific directory such /usr/local ?

well there is but only if you have mounted whole partition to /usr/local !!!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question