Solved

Free Space

Posted on 2001-06-14
5
239 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

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…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

821 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