The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]
Scripts / handy tips
 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Newer Topic  |  Older Topic 
 df(1) output resolution (or where is 8% missing space)
Author: parv 
Date:   23-12-05 01:14

The comment similar to the following comes up quite often on FreeBSD mailing list(s): in df(1) output "Avail" (4th column) and "Used" (3d) columns, for FreeBSD slices, do not add up to the "1K-blocks" (if BLOCKSIZE is set to 1kB; 2d column). Below is a short pipeline to confirm that comment (assuming default settings while setting up a slice)...

df -t ufs \
| tail +2 \
| awk ' { sum = $3 + $4 + $2 * 0.08;
printf "%s: space diff: %f\n" , $1 , $2 - sum
}
'


Above ...
- df -t ufs lists the usage only for mounted UFS slices;
- tail +2 skips the "Filesystem ... Mounted on" header;
- awk for each slice ...
-- sum = $3 + $4 + $2 * 0.08; sums up the 3d & 4th columns, and 8% of the total reported size;
-- printf "%s: space diff: %f\n" , $1 , $2 - sum prints the difference in the reported size and the calculated total size.

Reply To This Message
 Forum List  |  Threaded View   Newer Topic  |  Older Topic 


 Forum List  |  Need a Login? Register Here 
 User Login
 User Name:
 Password:
 Remember my login:
   
 Forgot Your Password?
Enter your email address or user name below and a new password will be sent to the email address associated with your profile.
How to get the most out of the forum

phorum.org