Solved

Free Space

Posted on 2001-06-14
5
236 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
  • 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 100 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
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 find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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…

758 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

17 Experts available now in Live!

Get 1:1 Help Now