System Administration Guide: Virtualization Using the Solaris Operating System

ProcedureHow to Add a Writable Directory under /usr in a Non-Global Zone

In a native sparse root zone, /usr is mounted read-only from the global zone. You can use this procedure to add a writable directory, such as /usr/local, under /usr in your zone.

You must be the global administrator in the global zone to perform this procedure.

  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. Create the directory /usr/local in the global zone.


    global# mkdir -p /usr/local
    
  3. Specify a directory in the global zone to serve as the backing store for the zone's /usr/local directory.


    global# mkdir -p /storage/local/my-zone
    
  4. Edit the configuration for the zone my-zone.


    global# zonecfg -z my-zone
    
  5. Add the loopback-mounted filesystem.


    zonecfg:my-zone> add fs
    zonecfg:my-zone:fs> set dir=/usr/local
            zonecfg:my-zone:fs> set special=/storage/local/my-zone
            zonecfg:my-zone:fs> set type=lofs
            zonecfg:my-zone:fs> end
            zonecfg:my-zone> commit
            zonecfg:my-zone> exit
    
  6. Boot the zone.