Solved

Free Space

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.

809 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