Creating and Using Oracle Solaris Kernel Zones

Exit Print View

Updated: December 2014
 
 

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

  1. Become an administrator.

    For more information, see Using Your Assigned Administrative Rights in Securing Users and Processes in Oracle Solaris 11.2 .

  2. Create an empty removable read-only lofi device.
    # lofiadm -r

    The following example shows sample output.

    global# lofiadm -r
    /dev/lofi/1
  3. Add the lofi device to the kernel zone.
    # zonecfg -z zonename

    The following example demonstrates adding the lofi device located at /dev/rlofi/1 to the kernel zone kzone1:

    global# zonecfg -z kzone1
    zonecfg:kzone1> add device
    zonecfg:kzone1:device> set match=/dev/rlofi/1
    zonecfg:kzone1:device> end
    zonecfg:kzone1> exit
  4. Reboot the kernel zone to have the configuration changes take effect.
    # zoneadm -z zonename reboot
  5. On the kernel zone, update the device file system ( devfs) and hardware abstraction layer (hal) so that the hal will see the new cdrom device.
    # devfsadm -i zvblk

    For example:

    global# devfsadm -i zvblk
    global# svcadm restart hal
    global# rmformat -l
    ...
        2. Logical Node: /dev/rdsk/c1dp0
            Physical Node: /zvnex/zvblk@1
            Connected Device: kz       vCDROM           0
            Device Type: CD Reader
            Bus: <Unknown>
            Size: 0.0 MB
            Label: <Unknown>
            Access permissions: Medium is write protected.
  6. Restart the hal service on the kernel zone.
    # svcadm restart hal
  7. List the removable devices on the zone.
    # rmformat -l

    For example, the following example lists the removable devices on the kernel zone kzone1:

    kzone1# 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>
         2. Logical Node: /dev/rdsk/c1d1p0
            Physical Node: /zvnex/zvblk@1
            Connected Device: kz       vCDROM           0
            Device Type: CD Reader
            Bus: <Unknown>
            Size: 0.0 MB
            Label: <Unknown>
            Access permissions: <Unknown>
    
  8. Insert a CD-ROM into the CD-ROM drive on the kernel zone.
    # lofiadm -r device-name device-path

    The following example demonstrates inserting the CD-ROM image /root/sol-11_3-repo.full.iso in the lofi device /dev/lofi/1 on the kernel zone kzone1:

    kzone1# lofiadm -r /root/sol-11_2-repo-full.iso /dev/lofi/1
    kzone1# lofiadm
    Block Device             File                           Options
    /dev/lofi/1              /root/sol-11_2-repo-full.iso        Removable,Readonly
  9. Mount the CD-ROM.
    # mount -F hsfs device-location /mnt

    The following example ounts the CD-ROM device located at /dev/dsk/c1d1p0.

    kzone1# mount -F hsfs /dev/dsk/c1d1p0 /mnt
  10. Unmount the CD-ROM device.
    # unmount /mnt
  11. Eject the CD-ROM.
    # eject cdrom
  12. Verify that the CD-ROM device is no longer present on the kernel zone host.
    # lofiadm

    For example:

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