DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Administering filesystems

Using marry to create filesystem images on files

The marry(7) driver and the marry(1M) command enable you to treat a regular file as a device. The driver is a dynamically loadable block (and character) device driver. The command enables you to ``marry'' a regular file (for example, a filesystem image) to the marry device. The regular file can then be mounted or otherwise accessed through the block or character device nodes created.

This is particularly useful in these cases:

The marry driver registers pathnames, instead of holding a married file open, while its device is closed (in this respect it resembles a symbolic link). This allows a filesystem containing forgotten marriages to be unmounted successfully. Because registered pathnames are normalized (that is, symbolic links are resolved), the pathname of a married device node might differ from that expected. Therefore, upon success, the marry command prints the pathname of the block node (to which you can create a more convenient symlink).

Because mkfs(1M) for a VxFS filesystem must be run on a character device, not a block device, marry also creates a character device node. Marrying path/file creates block node /dev/marry/path/file and character node /dev/marry/path/rfile. But, if path/rfile or /path/rfile/otherfile is married before or after, the raw device node cannot be created, or is removed, without warning. By default, device size is taken from file size when the marriage is created, but it may be set larger (or smaller) with the -b blocks option. If the married device will be used to create a filesystem, the maximum size of the device must be decided when the marriage is created.


NOTE: Do not use the marry driver to swap to a file. UnixWare allows swapping to a file in more efficient ways. See swap(1M) for more information.

Creating a married device

  1. Create an empty, temporary file. The touch(1) command is recommended to create an empty file.

  2. Execute marry using the following syntax:

    /usr/sbin/marry -a [-b blocks] regfile

    This creates a new device file under the /dev/marry directory. The -a option associates regfile with the marry device. The -b blocks option specifies the maximum size, in number-of-blocks, of the device.

  3. Execute marry -l to check that the married device has been created.

Creating and mounting a filesystem on a married device

  1. Execute mkfs(1M), to create a filesystem on the married device, using the following syntax:

    mkfs -F FStype /dev/marry/path/regfile size

  2. Execute mount(1M), to mount the filesystem on the married device, using the following syntax:

    mount /dev/marry/path/regfile /mnt

    This mounts the married device file at /mnt.


In the following example, a filesystem is created on /tmp/a. Note that after creating an empty file with touch(1), marry is used with the -b blocks option to to specify its size.

   # marry -l
   # touch /tmp/a
   # marry -a -b 5000 /tmp/a
   /dev/marry/tmp/a
   # mkfs -F vxfs /dev/marry/tmp/a 5000
   Mkfs: make vxfs file system?
   (DEL if wrong)
       version 4 layout
       5000 sectors, 2500 blocks of size 1024, log size 256 blocks
       unlimited inodes, largefiles not supported
       2500 data blocks, 2180 free data blocks
       1 allocation units of 32768 blocks, 32768 data blocks
       last allocation unit has 2500 data blocks
   # mount /dev/marry/tmp/a /mnt
   vxfs
   # marry -l
   /tmp/a by root to 15,1 /dev/marry/tmp/a 5000 blocks open

Mounting an existing filesystem image on a married device

  1. Execute marry(1M) using the following syntax:

    /usr/sbin/marry -a regfile

    This associates regfile (an existing file containing a filesystem image) with the marry device.

  2. Execute mount(1M), to mount the filesystem image on the married device, using the following syntax:

    mount /dev/marry/path/regfile /mnt


In the following example, marry(1M) is used to mount a filesystem image, hba.image. After it is mounted, the files in the image can be accessed without first transferring them to a floppy disk. This is possible because marry provides a device node for the file.

   # ls -l hba.image
   -rw-r--r--    1 root     sys         1474560 Sep 28 18:37 hba.image
   # marry -a hba.image
   /dev/marry/hba.image
   # mount /dev/marry/hba.image /mnt
   # cd /mnt
   # ls
   adsb        cpqsc       etc         ide         qlc2100
   adsl        dak         i2oOSM      lost+found
   c8xx        dpt         ida         qlc1020
   # cd /
   # umount /mnt
   # marry -l
   /hba.image by root to 15,1 /dev/marry/hba.image 2880 blocks closed
   # marry -d hba.image

Deleting a married device

The marry device can be disassociated from the regular file regfile. In effect, the device is removed from the system.

  1. Unmount the filesystem created on the marry device.

    umount /mnt

  2. Execute marry to delete the married device, using the following syntax:

    marry -d /dev/marry/path/regfile

regfile still remains as a regular file.

Listing currently active married devices

You can create up to 255 concurrent marriages on your system.

Execute the following command to list all currently active married files:

marry -l

The following example shows three married files: the first is a disk image that is mounted as a filesystem, the second shows a marriage that will be unmarried when the device is closed, and the third shows a file, used to create a filesystem, that is unmounted, but for which a marriage still exists.

   #marry -l
   /hba.image by root to 15,1 /dev/marry/hba.image 2880 blocks open
   /tmp/a by root to 15,2 removed 5000 blocks unmarry-on-close
   /tmp/c by sachin to 15,3 /dev/marry/tmp/c 3000 blocks closed

Next topic: Adding or modifying share configuration
Previous topic: DOS filesystem limitations

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 22 April 2004