System Administration Guide: Oracle Solaris Containers-Resource Management and Oracle Solaris Zones

ProcedureHow to Import Raw and Block Devices by Using zonecfg

This procedure uses the lofifile driver, which exports a file as a block device.

  1. Become superuser, or assume the Primary Administrator role.

    To create the role and assign the role to a user, see Using the Solaris Management Tools With RBAC (Task Map) in System Administration Guide: Basic Administration.

  2. Change directories to /usr/tmp.


    global# cd /usr/tmp
    
  3. Create a new UFS file system.


    global# mkfile 10m fsfile
    
  4. Attach the file as a block device.

    The first available slot, which is /dev/lofi/1 if no other lofi devices have been created, is used.


    global# lofiadm -a `pwd`/fsfile
    

    You will also get the required character device.

  5. Import the devices into the zone my-zone.


    global# zonecfg -z my-zone
    zonecfg:my-zone> add device
    zonecfg:my-zone:device> set match=/dev/rlofi/1
    zonecfg:my-zone:device> end
    zonecfg:my-zone> add device
    zonecfg:my-zone:device> set match=/dev/lofi/1
    zonecfg:my-zone:device> end
    
  6. Reboot the zone.


    global# zoneadm -z my-zone boot
    
  7. Log in to the zone and verify that the devices were successfully imported.


    my-zone# ls  -l /dev/*lofi/*
    

    You will see a display that is similar to this:


    brw-------   1 root     sys      147,  1 Jan  7 11:26 /dev/lofi/1
    crw-------   1 root     sys      147,  1 Jan  7 11:26 /dev/rlofi/1
See Also

For more information, see the lofiadm(1M) and lofi(7D) man pages.