ITPub博客

首页 > Linux操作系统 > Linux操作系统 > lofiadm: Solaris Mount an ISO CD Image

lofiadm: Solaris Mount an ISO CD Image

原创 Linux操作系统 作者:JoshuaJin 时间:2011-09-14 16:41:30 0 删除 编辑

Q. How do I mount an ISO CD image under Sun Solaris UNIX?

A. Just like linux loopback device Sun Solaris UNIX has lofi loopback file driver. 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 (such as ISO 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 mount and fsck. This is useful for accessing CD-ROM and FAT floppy images.

lofiadm is command you need to use mounting an existing CD-ROM image under Sun Solaris UNIX. This is useful when the file contains an image of some flesystem (such as a floppy or CD-ROM image), because the block device can then be used with the normal system utilities for mounting, checking or repairing filesystem

Mounting an Existing ISO CD-ROM Image under Solaris UNIX

If your image name is cd.iso, you can type command:
# lofiadm -a /path/to/cd.iso
Output:

/dev/lofi/1

Please note that the file name argument on lofiadm must be fully qualified and the path must be absolute not relative (thanks to mike for tip).

/dev/lofi/1 is the device, use the same to mount iso image with mount command:
# mount -o ro -F hsfs /dev/lofi/1 /mnt
# cd /mnt
# ls -l
# df -k /mnt

Mount the loopback device as a randomly accessible file system with
mount -F hsfs -o ro /dev/lofi/X /mnt.
Alternatively, use this combined format:
mount -F hsfs -o ro `lofiadm -a /path/to/image.iso` /mnt

Unmount and detach the images

Use umount command to unmount image:
# umount /mnt

Now remove/free block device:
# lofiadm -d /dev/lofi/1

For more information read lofiadm and lofi man pages by typing the following command:
man lofiadm


Solaris 中使用ISO文件,并将ISO共享

在Solaris中使用ISO文件,使用lofiad命令,把ISO文件模拟成一个块设备,然后挂接新生成的块设备。
root@x4500 # more S2mount.txt

echo "####################################################" > /etc/dfs/dfstab

unshareall
# lofiadm; unshareall; shareall; dfshares

echo "share -F nfs -o ro,anon=0 /disk11" >> /etc/dfs/dfstab
echo "share -F nfs -o ro,anon=0 /disk31" >> /etc/dfs/dfstab
echo "share -F nfs -o ro,anon=0 /disk41" >> /etc/dfs/dfstab

mkdir -p /disk0/eis/eis-dvd20070130
lofiadm -a /disk26/eis/eis-dvd20070130.iso
mount -F hsfs -o ro /dev/lofi/1 /disk0/eis/eis-dvd20070130
echo "share -F nfs -o ro,anon=0 /disk0/eis/eis-dvd20070130" >> /etc/dfs/dfstab


mkdir -p /disk0/eis/eis-dvd20070227
lofiadm -a /disk26/eis/eis-dvd20070227.iso
mount -F hsfs -o ro /dev/lofi/2 /disk0/eis/eis-dvd20070227
echo "share -F nfs -o ro,anon=0 /disk0/eis/eis-dvd20070227" >> /etc/dfs/dfstab


mkdir -p /disk0/eis/eis-dvd20070327
lofiadm -a /disk26/eis/eis-dvd20070327.iso
mount -F hsfs -o ro /dev/lofi/3 /disk0/eis/eis-dvd20070327
echo "share -F nfs -o ro,anon=0 /disk0/eis/eis-dvd20070327" >> /etc/dfs/dfstab


echo "##############################################################################" >> /etc/dfs/dfstab


shareall

# lofiadm; unshareall; shareall; dfshares


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25196159/viewspace-707421/,如需转载,请注明出处,否则将追究法律责任。

上一篇: Solaris 磁盘命名
请登录后发表评论 登录
全部评论

注册时间:2011-01-05

  • 博文量
    30
  • 访问量
    63531