System Administration Guide

Creating a Loopback File System (LOFS)

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

You can preserve a LOFS across reboots or unmounts by adding an entry to the /etc/vfstab file.


Caution - Caution -

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


How to Create a Loopback File System

  1. Become superuser.

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

  3. Create a loopback file system.


    # mount -F lofs loopback-directory mount-point
    

    loopback-directory

    The file system to be mounted at the loopback mount point. 

    mount-point

    The directory where the LOFS is mounted. 

Example--Creating a Loopback File System

This example shows how to use a new loopback file system with the chroot command to provide a complete virtual file system view of a process or family of processes:


# mount -F lofs / /tmp/newroot
# chroot /tmp/newroot command

See lofs(7FS) or mount(1M) for more information.

How to Preserve a Loopback File System

You can preserve a loopback file system across reboots or unmounts by adding an entry to the /etc/vfstab file. Edit the file to add an entry like this at the end of the file, separating each field with a tab.


/    -   mount-point  lofs   -   yes     -

mount-point

The default mount point directory (for example, /tmp/newroot).


Caution - Caution -

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


For more information about the /etc/vfstab file, refer to Chapter 28, Mounting and Unmounting File Systems (Tasks).