Vinnnnie
asked on
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?
/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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
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
df | awk '{n=n+$4} END {print n}'
for KB output
and
df -m | awk '{n=n+$4} END {print n}'
;)
Vijay
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
Third time lucky:
df | awk '{n+=$4} END {print n}'
for KB, and
df -m | awk '{n+=$4} END {print n}'
V
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