Solved

checking available room on remote machine

Posted on 2006-11-06
5
204 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
  • 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

In this tutorial I will explain how to make squid prevent malwares in five easy steps: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-…
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…
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…
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.

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now