Category Archives: UFS

memory disk: basic commands

Create a 1G sized file

$ truncate +1G boot.disk

Create memory disk out of the file

$ mdconfig -f boot.disk
md0

$ ls -l /dev/md0
crw-r-----  1 root  operator    0, 132 Aug 23 14:57 /dev/md0

Create a partitioning scheme (i.e. gpt below)

$ sudo gpart create -s gpt md0
md0 created

$ sudo gpart show md0
=>     34  2097085  md0  GPT  (1.0G)
       34  2097085       - free -  (1G)

Add a new partition

$ sudo gpart add -t freebsd-ufs md0
md0p1 added
$ sudo gpart show md0
=>     34  2097085  md0  GPT  (1.0G)
       34  2097085    1  freebsd-ufs  (1G)

Create a ufs filesystem

$ sudo newfs /dev/md0p1
/dev/md0p1: 1024.0MB (2097080 sectors) block size 32768, fragment size 4096
        using 4 cylinder groups of 256.00MB, 8192 blks, 32768 inodes.
super-block backups (for fsck_ffs -b #) at:
 192, 524480, 1048768, 1573056

Mount the filesystem

$ sudo mount /dev/md0p1 /mnt/
$ df -k
/dev/md0p1    1015416       8    934176     0%    /mnt

$ sudo mdconfig -l
md0

undo the experiment

unmount /mnt
$ sudo umount /mnt/

detach the disk
$ sudo mdconfig -d -u 0

A phoronix benchmark creates a huge benchmarking discussion

The recent Phoronix benchmark which compared a release candidate of FreeBSD 9 with Oracle Linux Server 6.1 created a huge discussion in the FreeBSD mailinglists. The reason was that some people think the numbers presented there give a wrong picture of FreeBSD. Partly because not all benchmark numbers are presented in the most prominent page (as linked above), but only at a different place. This gives the impression that FreeBSD is inferior in this benchmark while it just puts the focus (for a reason, according to some people) on a different part of the benchmark (to be more specific, blogbench is doing disk reads and writes in parallel, FreeBSD gives higher priority to writes than to reads, FreeBSD 9 outperforms OLS 6.1 in the writes while OLS 6.1 shines with the reads, and only the reads are presented on the first page). Other complaints are that it is told that the default install was used (in this case UFS as the FS), when it was not (ZFS as the FS).

The author of the Phoronix article participated in parts of the discussion and asked for specific improvement suggestions. A FreeBSD committer seems to be already working to get some issues resolved. What I do not like personally, is that the article is not updated with a remark that some things presented do not reflect the reality and a retest is necessary.

As there was much talk in the thread but not much obvious activity from our side to resolve some issues, I started to improve the FreeBSD wiki page about benchmarking so that we are able to point to it in case someone wants to benchmark FreeBSD. Others already chimed in and improved some things too. It is far from perfect, some more eyes — and more importantly some more fingers which add content — are needed. Please go to the wiki page and try to help out (if you are afraid to write something in the wiki, please at least tell your suggestions on a FreeBSD mailinglist so that others can improve the wiki page).

What we need too, is a wiki page about FreeBSD tuning (a first step would be to take the man-page and convert it into a wiki page, then to improve it, and then to feed back the changes to the man-page while keeping the wiki page to be able to cross reference parts from the benchmarking page).

I already told about this in the thread about the Phoronix benchmark: everyone is welcome to improve the situation. Do not talk, write something. No matter if it is an improvement to the benchmarking page, tuning advise, or a tool which inspects the system and suggests some tuning. If you want to help in the wiki, create a FirstnameLastname account and ask a FreeBSD comitter for write access.

A while ago (IIRC we have to think in months or even years) there was some framework for automatic FreeBSD benchmarking. Unfortunately the author run out of time. The framework was able to install a FreeBSD system on a machine, run some specified benchmark (not much benchmarks where integrated), and then install another FreeBSD version to run the same benchmark, or to reinstall the same version to run another benchmark. IIRC there was also some DB behind which collected the results and maybe there was even some way to compare them. It would be nice if someone could get some time to talk with the author to get the framework and set it up somewhere, so that we have a controlled environment where we can do our own benchmarks in an automatic and repeatable fashion with several FreeBSD versions.

Share

FreeBSD on 4K sector drives

All major FreeBSD filesystems support 4K sectors (UFS, ZFS, ext2), and so does the lower level - GEOM - but currently there's an issue of communicating this configuration between all the layers. A part of the problem is that the current drives (and the situation will probably not change during this new decade) advertise two sector sizes: both 512 byte and 4K, and the system needs to correctly interpret them. All this will be resolved when a consensus on the topic gets achieved, but until that happens (hopefully soon), there is a set of easy workarounds, which I'll describe here.

Read more...

FreeBSD on 4K sector drives

All major FreeBSD filesystems support 4K sectors (UFS, ZFS, ext2), and so does the lower level - GEOM - but currently there's an issue of communicating this configuration between all the layers. A part of the problem is that the current drives (and the situation will probably not change during this new decade) advertise two sector sizes: both 512 byte and 4K, and the system needs to correctly interpret them. All this will be resolved when a consensus on the topic gets achieved, but until that happens (hopefully soon), there is a set of easy workarounds, which I'll describe here.

Read more...

FreeBSD on 4K sector drives

All major FreeBSD filesystems support 4K sectors (UFS, ZFS, ext2), and so does the lower level - GEOM - but currently there's an issue of communicating this configuration between all the layers. A part of the problem is that the current drives (and the situation will probably not change during this new decade) advertise two sector sizes: both 512 byte and 4K, and the system needs to correctly interpret them. All this will be resolved when a consensus on the topic gets achieved, but until that happens (hopefully soon), there is a set of easy workarounds, which I'll describe here.

Read more...

UFS read-ahead

After 10 years of it being conservatively tuned, I've recently increased the default read-ahead (vfs.read_max) in FreeBSD from 128 KiB to a whopping 512 KiB. And of course, I have received an e-mail from a concerned developer asking if that is perhaps too high :)

How much impact can read_max have I'll try to illustrate on this excellent example on a machine I'm currently configuring.

Read more...

vfs.hirunningspace and disk write latency performance

A while ago I increased the default value for the vfs.hirunningspace tunable - which greatly helps with performance when the disk system supports tagged queueing (e.g. NCQ), allowing many more requests to be offloaded into the controller and/or the drive(s). But deep queues bring their own problems, especially in pathological cases.

Read more...

UFS journalling committed

Jeff Roberson has committed soft-updates journalling to 9-CURRENT! It enables a small file system journal which works in combination with soft-updates to eliminate boot fsck's. It is different from most other implementations of file system journalling in that it doesn't journal raw blocks but sort of meta-data about meta-data (hyper-data?).

Read more...

UFS journalling committed

Jeff Roberson has committed soft-updates journalling to 9-CURRENT! It enables a small file system journal which works in combination with soft-updates to eliminate boot fsck's. It is different from most other implementations of file system journalling in that it doesn't journal raw blocks but sort of meta-data about meta-data (hyper-data?).

Read more...

SoftUpdates – the next generation (or SU+J)

Jeff Roberson is working on an addition to UFS softupdates which includes a tiny journal to keep track of things like free space and inode orphaning that were left to background fsck to deal with in the original implementation of softupdates. Basically, it's still the same old softupdates but without the need for (bg)fsck to be run for recovery!

Read more...

UFS file system space allocation policy

Users coming from other systems don't usually know it (and probably don't care, in today's environment of multi-TB drives), but UFS has a rather interesting approach to space allocation which is different from the "usual suspects" like ext2/3, NTFS and FAT(32). Though it sometimes feels "interesting" in the sense of the Chinese proverb, it's time-tested to work.

I'm talking about clustering, blocks and fragments.

Read more...