• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 269
  • Last Modified:

Free Space

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
Vinnnnie
Asked:
Vinnnnie
  • 3
1 Solution
 
crouchetCommented:
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
 
dorwardCommented:
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
 
vsamtaniCommented:
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
 
vsamtaniCommented:
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
 
vsamtaniCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now