Howto: Mount LOFS File System To Running Solaris 10 Zone

How to mount a loopback file system to a running Solaris 10 zone (i.e. container) from the global zone. In the example below, I’m mounting the the lofs file system as read-only so the Non-global zone cant modify the contents.

1. Global zone name: global
2. Non-global zone name: ngzname
3. Disk you want mounted: c1t1d1s0
4. Non-global zone is up and running

Let’s get started.

1. Identify the disk you want to mount from the global to the zone. In this case its c1t1d1s0.

2. Mount the disk as you normally would from the global zone.
a. Create the mount point from the global zone

        # mkdir /mnt/olddisk

b. Create the mount point for the Non-global zone

        # mkdir /zones/ngzname/root/mnt/olddisk

3. Mount the disk to both the global and Non-global zone
a. For the global

        # mount /dev/dsk/c1t1d1s0 /mnt/olddisk

b. For the Non-global
ENSURE ngzone is up and running. For me, mounting the file system as read-only was a requirement. Your mileage may vary.

        # mount -o ro -F lofs /mnt/olddisk /zones/ngzname/root/mnt/olddisk

4. Verify mount point is up and running
a. From global

         # df -h /mnt/olddisk
         # mount | grep /mnt/olddisk

b. Log into Non-global zone

          # df -h /mnt/olddisk

The disk should be mount as read only from the global to the Non-global zone as read-only. Enjoy!

About this entry