- 论坛徽章:
- 0
|
各位老大:我第一次写这种东西,抛砖引玉,欢迎大家狠劲儿砸我。
需要了解的命令:lofiadm(1M), mount(1M)
必须使用root权限。
比如说我有一个文件Winxp.ISO是一个标准的光盘映像文件,放置在/tmp下面。
键入如下命令:
# lofiadm -a /tmp/Winxp.ISO
/dev/lofi/1
#
等到提示符出现就说明虚拟的设备点已经生成。系统所返回的是一个block device 为止,但是同时系统其实还提供了一个raw device在:/dev/rlofi/1
对于raw device的操作,诸如fsck之类,必须对这个device 做才会有效。
然后,
# mkdir /mount_ISO
# mount -F hsfs /dev/lofi/1 /mount_ISO
到此为止你就可以在/mount_ISO下面像在光盘里面一样执行命令了。
删除设备:
# umount /mount_ISO
( 如果不成功,可以使用-f选项枪支卸载)
# lofiadm -d /tmp/Winxp.ISO
下面是相关的man页:
lofi:
Devices lofi(7D)
NAME
lofi - Loopback file driver
DESCRIPTION
The lofi file driver exports a file as a block device.
Reads and writes to the block device are translated to reads
and writes on the underlying file. This is useful when the
file contains a file system image. Exporting it as a block
device through the lofi file driver allows normal system
utilities to operate on the image through the block device
(like fstyp(1M)fsck(1M), and mount(1M). This is useful for
accessing CD-ROM and FAT floppy images. See lofiadm(1M) for
examples.
File block device entries are contained in /dev/lofi, while
/dev/rlofi contains the character (or raw) device entries.
Entries are in the form of decimal numbers which are
assigned through lofiadm(1M). When created, these device
entries are owned by root, in group sys, and have permis-
sions 0600. While ownership, group, and permission settings
can be altered, there are possible ramifications. See
lofiadm(1M) for more information.
FILES
/dev/lofictl
Master control device
/dev/lofi/n
Block device for file n
/dev/rlofi/n
Character device for file n
/kernel/drv/lofi
32-bit driver
/kernel/drv/lofi.conf
Driver configuration file. (Should not be altered.)
/kernel/drv/sparcv9/lofi
64-bit driver
ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
SunOS 5.8 Last change: 30 Jul 1999 1
SEE ALSO
lofiadm(1M), fsck(1M), fstyp(1M), mount(1M), newfs(1M),
attributes(5)
NOTES
Just as you would not directly access a disk device that has
mounted file systems, you should not access a file associ-
ated with a block device except through the lofi file
driver.
For compatability purposes, a raw device is also exported
along with the block device. For example, newfs(1M) requires
one.
hsfs:
File Systems hsfs(7FS)
NAME
hsfs - High Sierra & ISO 9660 CD-ROM file system
DESCRIPTION
HSFS is a file system type that allows users access to files
on High Sierra or ISO 9660 format CD-ROM disks from within
the SunOS operating system. Once mounted, a HSFS file system
provides standard SunOS read-only file system operations and
semantics. That is, users can read files and list files in
a directory on a High Sierra or ISO 9660 CD-ROM, and appli-
cations can use standard UNIX system calls on these files
and directories.
This file system also contains support for the Rock Ridge
Extensions. If the extensions are contained on the CD-
ROM, then the file system will provide all of the file sys-
tem semantics and file types of UFS, except for writability
and hard links. |
|