Solved

checking available room on remote machine

Posted on 2006-11-06
5
210 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 250 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

738 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