Solved

checking available room on remote machine

Posted on 2006-11-06
5
205 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)

Question has a verified solution.

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

Suggested Solutions

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Fine Tune your automatic Updates for Ubuntu / Debian
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

919 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

15 Experts available now in Live!

Get 1:1 Help Now