System Administration Guide, Volume 1

Creating a Loopback File System (LOFS)

A LOFS file system is a virtual file system that provides an alternate path to an existing file system. When other file systems are mounted onto a LOFS file system, the original file system does not change.

See the lofs(7FS) man page for more information.

Caution - Caution -

Be careful when creating LOFS file systems. Because these are virtual file systems, the potential for confusing both users and applications is enormous.

How to Create a LOFS File System

  1. Become superuser.

  2. Create the directory where you want to mount the LOFS file system and give it the appropriate permissions and ownership.

  3. Create a LOFS file system.

    To set up the system to automatically create a TMPFS file system when it boots, see "Example--Creating a LOFS File System at Boot Time".

    # mount -F lofs loopback-directory mount-point


    Specifies the file system to be mounted on the loopback mount point. 


    Specifies the directory on which to mount the LOFS file system. 

  4. Look at the output from the mount command to verify that the LOFS file system has been created.

    # mount -v

Example--Creating a LOFS File System

The following example illustrates how to mount and test new software as a loopback file system without actually having to install it.

# mkdir /tmp/newroot
# mount -F lofs /new/dist /tmp/newroot/usr/local
# chroot /tmp/newroot command

Example--Creating a LOFS File System at Boot Time

You can set up the system to automatically create a LOFS file system when it boots by adding an entry to the end of the /etc/vfstab file. The following example shows an entry in the /etc/vfstab file that will create a LOFS file system for the root (/) file system on /tmp/newroot.

/ - /tmp/newroot  lofs   -  yes  -

Caution - Caution -

Make sure the loopback entries are the last entries in the /etc/vfstab file. Otherwise, if the /etc/vfstab entry for a loopback file system precedes the file systems to be included in it, the loopback file system cannot be created.

For more information the /etc/vfstab file, see "The /etc/vfstab Field Descriptions".