System Administration Guide: Devices and File Systems

Creating a Swap File in a UFS Root Environment

You can create a swap file to be used in a UFS root file system. Swap files are currently not supported in a ZFS root environment. The following general steps are involved in creating a swap file:

mkfile Command

The mkfile command creates a file that is suitable for use as either an NFS-mounted swap area or a local swap area. The sticky bit is set, and the file is filled with zeros. You can specify the size of the swap file in bytes (the default) or in KB, blocks, or MB by using the k, b, or m suffixes, respectively.

The following table shows the mkfile command options.

Table 20–2 Options to the mkfile Command




Creates an empty file. The size is noted. However, the disk blocks are not allocated until data is written to them. 


Reports the names and sizes of created files. 

Note –

Use the -n option only when you create an NFS swap file.