Loopback Virtual Filesystem A Few Other Filesystem Issues

As the need for system memory increases, swapfs makes more space by backing swapped pages into the disk−based swap area swap partition. The worst−case scenario is a well−known swap structure: physical memory is used as system memory, and the swap area is restricted to the swap partition. As soon as more room has been made in the memory, a swap space can expand in that way. Such a flexible approach implies that all swap partitions, including the primary one, should be mounted through entries in the filesystem configuration file. Otherwise, there is no need for a default primary swap configuration entry; it is already well known to the system.

5.5.3 Loopback Virtual Filesystem

Modern UNIX versions introduced a more flexible way to merge individual filesystems into the overall UNIX hierarchical filesystem. Initially, UNIX filesystems could be handled only as complete partitions; this meant that only a complete filesystem within a partition could be merged by mounting the top−most directory from the partitions filesystem onto the mount−point supposedly an empty directory within the overall UNIX filesystem. It also meant that to access any file within a partition, a long trip from the starting partitions point was often required. The requested long pathname could be accepted, but for a number of applications, doing so required a careful selection of the filesystems mountpoint. In some cases symbolic links could help in skipping a part of the path, thereby reaching the needed data using a corresponding shortcut. However, a real advantage would be to mount the same filesystem in different ways — such flexibility would be quite an improvement. A new approach was introduced, known as the loopback filesystem lofs. Once the filesystem is mounted in the usual way, lofs allows new, virtual filesystems to be created, which provide access to existing files using alternate pathnames. Once the virtual filesystem is created, other filesystems can be mounted within it without affecting the original filesystem. At the same time, filesystems that are subsequently mounted onto the original filesystem continue to be visible to the virtual filesystem. The new filesystem type lofs requires a slightly modified treatment by the OS; however, all of the filesystems issues remain transparent. The idea for lofs came from the network filesystem nfs, which will be discussed later in Chapter 18. If something could be implemented through the network, obviously it could be implemented locally, too. Instead of a network interface, the local loopback interface should be used, and that is the origin of the filesystems name. An example from HP−UX 10.20 follows. The corresponding lofs entries in the filesystem configuration file etcfstab are presented: cat etcfstab partially presented, here ..... devvg01lvol10 files vxfs rw,suid,delaylog,datainlog 0 2 filesexportshareud usrud lofs defaults 0 0 filesexporthome home lofs defaults 0 0 filesexporthome users lofs defaults 0 0 filestmp tmp lofs defaults 0 0 The first line defines how the initial original filesystem is mounted the type, vxfs, will be discussed later; the filesystem resides in the logical volume lvol10 which will also be discussed later; and it is mounted into the files directory. Other lines define how to remount parts of the very same 132 How are the systems mounted? Here is the partial report of the mount command: mount partially presented too ..... ..... files on devvg01lvol10 delaylog on Sat May 16 23:30:37 1998 usrud on filesexportshareud defaults on Sat May 16 23:31:10 1998 users on filesexporthome defaults on Sat May 16 23:31:10 1998 tmp on filestmp defaults on Sat May 16 23:31:10 1998 home on filesexporthome defaults on Sat May 16 23:31:10 1998 The lines presented here correspond to those presented earlier in the filesystem configuration file etcfstab. It is clear to see that the system was rebooted on Saturday, May 16, 1998.

5.6 Managing Filesystem Usage