Section: User Commands (1)
Updated: June 2014


cvmkfile – Create a pre-allocated file


cvmkfile [-epswz] [-k key] size[k|m|g|t] filename


cvmkfile can be used to pre-allocate a file onthe StorNext file system. This is useful and preferable when preparing a file for use in a real-time or streaming environment as the entire file is represented in only one file system extent. Additionally, a file can be placed onto a specific stripe group by specifying the key value, which is used as the affinity locator. See snfs_config(5) for more details about affinities.

WARNING: This will destroy all existing data for the specified file unless the -e option is used.


The -e option tells cvmkfile not to clobber an existing file, just expand or verify the requested space. The default behavior is to unlink and re-create an existing file (see WARNING above).
-k key
The -k key optionally tells the file system where to place the data file. If an Affinity Key is specified, the file is placed on stripe groups that are specified to support this key. If there is no stripe group with the key specified, then the file is placed in non-exclusive data pools. If there are no non-exclusive data pools, then ENOSPC (no space) is returned.
The -p option forces the allocation and any subsequent expansions to be fitted “perfectly” as multiples of the PerfectFitSize configuration parameter. The allocation extent will always line up on and be a perfect multiple of the number of blocks specified in PerfectFitSize.
The -s option forces the allocation to line up on the beginning block modulus of the stripe group. This can help performance in situations where the I/O size perfectly spans the width of the stripe group’s disks.
The -w option sets the file size to be equal to size. Without this option the blocks are allocated but the size is set to zero. NOTE: Unless the -z option is used, the new file will contain undefined data. Using the -w option is not recommended unless absolutely needed, and beware that it could cause some write operations to become read-modify-write operations.
The -z option causes the file to be physically zeroed out. This can take a significant amount of time.
The size argument specifies the number of bytes, kilobytes(k), megabytes(m), gigabytes(g), terabytes(t) to allocate for the file. Multiple extents will be allocated if there is insufficient contiguous available space to satisfy the requested amount. In the event that there is not enough space to satisfy the request, the file size will still reflect the requested size value if the -w option is specified.
The file to be created.


Make a file of one gigabyte with zero length. Allocate it on a stripe group that has specified the affinity key 6100_n8.

rock # cvmkfile -k 6100_n8 1g foobar


snfs_config(5), cvmkdir(1)