How to Add a Virtual CD-ROM Device to a Kernel Zone

Perform this task to add a virtual CD-ROM device to a kernel zone.

  1. Become a zone administrator.
  2. Create an empty removable read-only lofi device in the global zone.
    global$ pfbash lofiadm -r

    The following example shows sample output.

    global$ lofiadm -r
    /dev/lofi/1
  3. Add the lofi device to the kernel zone.

    Output is similar to the following:

    global$ zonecfg -z kzone
    zonecfg:kzone> add device
    zonecfg:kzone:device> set storage=dev:path-to-device
    zonecfg:kzone:device> end
    zonecfg:kzone> exit
  4. Reboot the kernel zone to apply the configuration changes.
    global$ zoneadm -z kzone reboot
  5. Log in to the kernel zone.
    global$ zlogin kzone
  6. On the kernel zone, update the device file system (devfs) and restart the hardware abstraction layer (hal).

    This step enables the hal service to see the virtual CD-ROM device.

    kzone$ pfbash devfsadm -i zvblk
    kzone$ svcadm restart hal
  7. On the kernel zone, list the removable devices.

    Output is similar to the following:

    kzone$ rmformat -l
    Looking for devices...
         1. Logical Node: /dev/rdsk/c1d0p0
            Physical Node: /zvnex/zvblk@0
            Connected Device: kz       vDisk            0
            Device Type: Removable
            Bus: <Unknown>
            Size: 16.4 GB
            Label: <Unknown>
            Access permissions: <Unknown>
    …
  8. In the global zone, specify a path to an ISO image file to associate with the removable loopback device.
    global$ lofiadm -r image-path device-path

    The following example demonstrates associating the CD-ROM image /root/sol-11_3-repo.full.iso to the lofi device /dev/lofi/1:

    global$ lofiadm -r /root/sol-11_3-repo-full.iso /dev/lofi/1
    global$ lofiadm
    Block Device             File                           Options
    /dev/lofi/1              /root/sol-11_3-repo-full.iso        Removable,Readonly
  9. In the kernel zone, mount the CD-ROM device.
    kzone$ mount -F hsfs device-location /mnt
  10. When you are finished using the virtual CD-ROM, unmount it from the mount point in the kernel zone.
    kzone$ umount /mnt
  11. Eject the CD-ROM virtual device in the kernel zone.
    kzone$ eject cdrom
  12. In the global zone, verify that the ISO image is no longer associated with the lofi device.

    Output is similar to the following:

    global$ lofiadm
    Block Device             File                           Options
    /dev/lofi/1              -                              Removable,Readonly