Preallocating files sequentially on VxFS file systems

One cool feature that is built into VxFS is the ability to preallocate files sequentially on disk. This capability can benefit sequential workloads, and will typically result in higher throughput since disk seek times are minimized (LBA addressing, disk drive defect management and storage array abstractions can sometimes obscure this, so this may not always be 100% accurate).

To use the VxFS preallocation features, a file first needs to be created:

$ dd if=/dev/zero of=oradata01.dbf count=2097152
2097152+0 records in
2097152+0 records out

In this example, I created a 1GB file (2097152 blocks * 512-bytes per block gives us 1GB) named oradata01.dbf, and double checked that it was 1GB by running ls with the “-h” option:

$ ls -lh

total 3.1G
-rw-r--r--  1 root root 1.0G Aug 25 09:06 oradata01.dbf

After a file of the correct size has been allocated, the setext utility can be used to reserve blocks for that file, and to create an extent that matches the number of blocks allocated to the file:

$ setext -r 2097152 -e 2097152 oradata01.dbf

To verify the settings that were assigned to the file, the getext utility can be used:

$ getext oradata01.dbf

oradata01.dbf:  Bsize  1024  Reserve 2097152  Extent Size 2097152

This is an awesome feature, and yet another reason why VxFS is one of the best file systems available today!

1 thought on “Preallocating files sequentially on VxFS file systems”

  1. Hang on, what? dd should have already filled the blocks required for that file with zeroes, shouldn’t it? Where did those zeroes go?

    Do you have any good pointers to VxFS internals documentation? I don’t understand what this is doing.

Leave a Reply

Your email address will not be published. Required fields are marked *