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

x
?
Solved

Free Space

Posted on 2001-06-14
5
Medium Priority
?
261 Views
Last Modified: 2010-04-20
I am using FreeBSD and would like to know exactly how much free space I have on my hard drive at any given time. If I do a DF, this is what I get:

/dev/ad0s1a     49583    27912    17705    61%    /
/dev/ad0s1f   3877828   248293  3319309     7%    /usr
/dev/ad0s1e     19815     1618    16612     9%    /var
procfs              4        4        0   100%    /proc

Is this in Bytes? I believe I have a 4 GIG or a 3 GIG Drive in this machine. Is there a way to tell how much free space in MB I have left? Kinda like windows chkdsk?

I would also like to know if there is a way I can specify a username not to go back in a folder. For instance, If I setup username blah on my server, Is there a way I can tell ONLY that user has access ONLY to the /usr/home/blah folder and nothing below that subdirectory?

0
Comment
Question by:Vinnnnie
[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
5 Comments
 
LVL 1

Expert Comment

by:crouchet
ID: 6193177
Not bytes, 1-K blocks (i.e. a kilobyte). So yor root directory (/) has 17.7 meg free and your /usr directory has 3.3 gig free. If that was my system I would want a lot more space in / (especially sence /home and /tmp are not seperate partitions) and less in /usr.

Here is a DF from my machine with the heading from DF included. As you can see, the third column is the one that tells you the amount of free (Available) space.

Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/hda8               497829    335615    136512  72% /
/dev/hda5                23302      8342     13757  38% /boot
/dev/hda1              2028098   1301788    621488  68% /home
/dev/hda7              6040288   4296264   1437188  75% /usr

JC
0
 
LVL 17

Accepted Solution

by:
dorward earned 400 total points
ID: 6193290
You might like the "-h" option to df, which prints it in a human friendly way.

This is the output on my system as an example:

david@goth:david]df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda7             2.9G  507M  2.2G  19% /
/dev/hda5              15M  9.1M  5.3M  63% /boot
/dev/hda9             8.3G  2.8G  5.1G  35% /home
/dev/hda1             4.9G  3.9G 1015M  80% /mnt/windows/c
/dev/hda10            4.1G  3.6G  518M  88% /mnt/windows/e
/dev/hdd2             9.3G  735M  8.5G   8% /mnt/windows/d
/dev/hda8             7.9G  3.7G  3.8G  49% /usr
/dev/hdd1              15M  2.2M   12M  15% /mnt/debian/boot
/dev/hdd3             9.2G   31M  8.6G   1% /mnt/debian/slash
/dev/hdd6             9.2G  6.6G  2.1G  75% /media
david@goth:david]
0
 
LVL 5

Expert Comment

by:vsamtani
ID: 6194656
If you type the following at a prompt, it will give you total available free space in KB:

 df | awk '{n=n+$4} END {print n}'

and if you type this it will give you the answer in MB:

 df -m | awk '{n=n+$4} END {print n}'



Vijay
0
 
LVL 5

Expert Comment

by:vsamtani
ID: 6194672
Hmmm...that was ugly scripting - it would be marginally better as:

df | awk '{n=n+$4} END {print n}'

for KB output

and

df -m | awk '{n=n+$4} END {print n}'

;)

Vijay
0
 
LVL 5

Expert Comment

by:vsamtani
ID: 6194676
Shoot me now.

Third time lucky:

df | awk '{n+=$4} END {print n}'

for KB, and

df -m | awk '{n+=$4} END {print n}'



V
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

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 …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

604 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