FreeBSD 9 newfs block size and fragment size
Latest update:
In FreeBSD 9.0 beta1 2 new defaults for newfs(8) were introduced:
#define DFL_FRAGSIZE 4096
#define DFL_BLKSIZE 32768
Previous values (FreeBSD ≤ 8.2) were 2 times smaller. This means that by default new UFS filesystems will have 2 times less inodes.
This can be an unpleasant surprise if you want to quick install FreeBSD into a virtual machine with a small virtual hdd. For example, a quite modest setup with 4GB virtual hdd may bring you a /usr partition ~ 2.7GB. How many inodes is that?
The rough formula is:
where s is a partition size in MB and f is a magic number called
fragment size. The new default is 4096 bytes (controlled by -f
newfs(8) option).
So, for our example, the /usr partition will contain max 172,800 inodes. Isn't that enough? (And why should I care?)
For a partitions larger than, say 6GB, you'll rarely ever bother with the word inode. But for smaller ones and such as /usr which usually holds full ports tree directory, you can put yourself into a strange situation when after a fresh FreeBSD install your /usr has ~ plenty of a free space but almost no free inodes.
Returning to our 2.7GB partition example, just after the installation and csup'ing of the ports tree, the number of files is:
# find /usr | wc -l
163114
Or 94.4% of max possible files.
To make things worse, a new installer in FreeBSD 9.0 beta1 doesn't
allow you to specify the fragment size & block size (b) values at
all. The last one is important too, because the condition b/8 ≤ f ≤
b must be satisfied.
- After that number you'll get a dismal message from the
kernel:
/usr: create/symlink failed, no inodes free.
Tags: ойті
Authors: ag