|
|
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.
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.
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
This associates regfile (an existing file containing a filesystem image) with the marry device.
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
The marry device can be disassociated from the regular file regfile. In effect, the device is removed from the system.
regfile still remains as a regular file.
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