Sunday, February 17, 2008

Solaris How to LOFS (Loopback File system)

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 an LOFS file system, the original file system does not change.

For more information, see the lofs(7FS).
--------------------------------------------------------------------------------
Caution –
Be careful when creating LOFS file systems. Because LOFS file systems are virtual file systems, the potential for confusing both users and applications is enormous.
--------------------------------------------------------------------------------

How to Create an LOFS File System
Become superuser or assume an equivalent role.

Create the directory you want to mount as an LOFS file system, if necessary.

# mkdir loopback-directory

Grant the appropriate permissions and ownership on the newly created directory.
Create the mount point where you want to mount the LOFS file system, if necessary.

# mkdir /mount-point


Mount the LOFS file system.
# mount -F lofs loopback-directory /mount-point

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

/mount-point
Specifies the directory on which to mount the LOFS file system.

Verify that the LOFS file system has been mounted.
# mount -v

Example—Creating and Mounting an LOFS File System
The following example illustrates how to create, mount, and test new software in the /new/dist directory as a loopback file system without actually having to install it.
# mkdir /tmp/newroot
# mount -F lofs /new/dist /tmp/newroot
# chroot /tmp/newroot newcommand

Example—Mounting an LOFS File System at Boot Time
You can set up the system to automatically mount an 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 mounts an LOFS file system for the root (/) file system on /tmp/newroot.

No comments:

UNIX: How to print column nicely using printf

[user@hostfwnms1-oam tmp]# cat b.sh printf "%-26s %-19s %-8s %-8s %-s %-s\n" HOSTNAME IP PING SNMPWALK 0-ok 1-fail for i in `cat n...