Jan 022007
 

# more zonecfg-hints.txt
LOFS mount:

global# newfs /dev/rdsk/c1t0d0s0
global# mount /dev/dsk/c1t0d0s0 /mystuff
global# zonecfg -z my-zone
zonecfg:my-zone> add fs
zonecfg:my-zone:fs> set dir=/usr/mystuff
zonecfg:my-zone:fs> set special=/mystuff
zonecfg:my-zone:fs> set type=lofs
zonecfg:my-zone:fs> end
* Use a UFS mount:

global# newfs /dev/rdsk/c1t0d0s0
global# zonecfg -z my-zone
zonecfg:my-zone> add fs
zonecfg:my-zone:fs> set dir=/usr/mystuff
zonecfg:my-zone:fs> set special=/dev/dsk/c1t0d0s0
zonecfg:my-zone:fs> set raw=/dev/rdsk/c1t0d0s0
zonecfg:my-zone:fs> set type=ufs
zonecfg:my-zone:fs> end
* Export the device node and mount from the non-global zone:

global# zonecfg -z my-zone
zonecfg:my-zone> add device
zonecfg:my-zone:device> set match=/dev/rdsk/c1t0d0s0
zonecfg:my-zone:device> end
zonecfg:my-zone> add device
zonecfg:my-zone:device> set match=/dev/dsk/c1t0d0s0
zonecfg:my-zone:device> end
my-zone# newfs /dev/rdsk/c1t0d0s0
my-zone# mount /dev/dsk/c1t0d0s0 /usr/mystuff
* Mount the FS directly from the Global zone when the non-global zone is run
ning:

global# mount /dev/dsk/c1t0d0s0 /export/zones/zone1/root/mnt
* Using lofiadm

#

 Posted by at 8:08 pm
Jan 022007
 

Cannot manipulate system device files in local zones (only in global zones). But one can export special devices such as Sun Volume Manager devices, network devices, etc from global to local zones.

EG: Creating an SVM soft partition that I want to use exclusively for a local zone (z1 in this case).

dwailsun:(/) # metainit d43 -p d4 300m
d43: Soft Partition is setup

dwailsun:(/) # metastat -p
d3 1 1 c0t0d0s3
d1 1 1 c0t0d0s1
d0 1 1 c0t0d0s0
d43 -p d4 -o 1638496 -b 614400
d4 1 1 c0t0d0s4
d42 -p d4 -o 819264 -b 819200
d41 -p d4 -o 32 -b 819200

dwailsun:(/) # newfs /dev/md/rdsk/d43
newfs: construct a new file system /dev/md/rdsk/d43: (y/n)? y
Warning: 480 sector(s) in last cylinder unallocated
/dev/md/rdsk/d43: 614400 sectors in 610 cylinders of 16 tracks, 63 sectors
300.0MB in 39 cyl groups (16 c/g, 7.88MB/g, 3776 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 16224, 32416, 48608, 64800, 80992, 97184, 113376, 129568, 145760,
468576, 484768, 500960, 516128, 532320, 548512, 564704, 580896, 597088,
613280,

Now trying out various methods of provisioning this logical volume to the zone “z1″.

Can we export it (from the global zone) as a filesystem?
We could — but then we’ll have to mount it up on global zone first. So let’s skip this one…

dwailsun:(/) # zonecfg -z z1
zonecfg:z1> add fs
zonecfg:z1:fs>
zonecfg:z1:fs> end
dir not specified
special not specified
type not specified
zonecfg:z1:fs> cancel

Can we directly add the SVM metadevices to the local zone?
After much heartache I found it it’s not possible (yet). We can however provide solaris native slices
(/dev//c0t0d0s0 type devices) via the following method.

zonecfg:z1> add device
zonecfg:z1:device> set match=/dev/md/rdsk/d43
zonecfg:z1:device> end
zonecfg:z1> info
zonepath: /zones/z1
autoboot: true
pool:
inherit-pkg-dir:
dir: /lib
inherit-pkg-dir:
dir: /platform
inherit-pkg-dir:
dir: /sbin
inherit-pkg-dir:
dir: /usr
net:
address: 192.168.1.2
physical: eri0
device
match: /dev/md/rdsk/d43
zonecfg:z1>exit

dwailsun:(/) #
dwailsun:(/) # zlogin z1
[Connected to zone ‘z1′ pts/4]
Last login: Tue Apr 25 16:06:22 on pts/4
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
dwailsun-z1:(/) #
dwailsun-z1:(/) # newfs /dev/md/rdsk/d43
newfs: /dev/md/rdsk/d43: No such file or directory

dwailsun-z1:(/) # exit

[Connection to zone ‘z1′ pts/4 closed]

zonecfg:z1> add device
zonecfg:z1:device> set match=/dev/md/dsk/d43

zth: /zones/z1
autoboot: true
pool:
inherit-pkg-dir:
dir: /lib
inherit-pkg-dir:
dir: /platform
inherit-pkg-dir:
dir: /sbin
inherit-pkg-dir:
dir: /usr
net:
address: 192.168.1.2
physical: eri0
device
match: /dev/md/rdsk/d43
device
match: /dev/md/dsk/d43
onecfg:z1:device> zonecfg:z1> verify
zonecfg:z1> commit
zonecfg:z1> info
zonepath: /zones/z1
autoboot: true
pool:
inherit-pkg-dir:
dir: /lib
inherit-pkg-dir:
dir: /platform
inherit-pkg-dir:
dir: /sbin
inherit-pkg-dir:
dir: /usr
net:
address: 192.168.1.2
physical: eri0
device
match: /dev/md/rdsk/d43
device
match: /dev/md/dsk/d43
zonecfg:z1> exit
dwailsun:(/) # zlogin z1
[Connected to zone ‘z1′ pts/4]
Last login: Tue Apr 25 16:06:45 on pts/4
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
dwailsun-z1:(/) # newfs /dev/md/dsk/d43
newfs: /dev/md/dsk/d43: No such file or directory

Obviously that doesn’t work. So let’s blow that away and try a different option…

zonecfg:z1> remove device match=/dev/md/rdsk/d43
zonecfg:z1> remove device match=/dev/md/dsk/d43

Let’s try by adding the metadevice after newfs’ing it in the global zone but not as a device, but an UFS filesystem instead.

zonecfg:z1> add fs
zonecfg:z1:fs> set dir=/build
zonecfg:z1:fs> set special=/dev/md/dsk/d43
zonecfg:z1:fs> set raw=/dev/md/rdsk/d43
zonecfg:z1:fs> set type=ufs
zonecfg:z1:fs> end

dwailsun-z1:(/) # df -k /build
Filesystem kbytes used avail capacity Mounted on
/build 288151 13753 245583 6% /build

dwailsun-z1:(/) # cat /etc/mnttab |grep build
/build /build ufs rw,intr,largefiles,logging,xattr,onerror=panic,dev=154002b 1146064117

And even though this doesn’t show up in the local zone’s /etc/vfstab, the UFS filesystem is being exported (exclusively) for the local zone (z1) from the global zone (in this case).

dwailsun:(/) # zoneadm list -vc
ID NAME STATUS PATH
0 global running /
2 z2 running /zones/z2
– z1 installed /zones/z1

dwailsun:(/) # zlogin -C -e\@ z1
[Connected to zone ‘z1′ console]

dwailsun-z1 console login: root
Password:
Apr 26 09:28:19 dwailsun-z1 login: ROOT LOGIN /dev/console
Last login: Wed Apr 26 09:22:48 on pts/5
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
dwailsun-z1:(/) # init 6
dwailsun-z1:(/) # svc.startd: The system is coming down. Please wait.
svc.startd: 57 system services are now being stopped.
Apr 26 09:28:30 dwailsun-z1 syslogd: going down on signal 15
svc.startd: The system is down.

[NOTICE: Zone rebooting]

zonecfg:z1> add inherit-pkg-dir
Zone z1 already installed; add inherit-pkg-dir not allowed.
zonecfg:z1> export -f /var/tmp/tools/z1.cfg

dwailsun:(/) # zoneadm -z z1 uninstall
Are you sure you want to uninstall zone z1 (y/[n])? y

Configuring a zone to access the CDROM drive

zonecfg:z1> add fs
zonecfg:z1:fs> set dir=/cdrom
zonecfg:z1:fs> set special=/cdrom
zonecfg:z1:fs> set type=l
zonecfg:z1:fs> set options=[nodevices]
zonecfg:z1:fs> verify
resource specification incomplete
z1: Insufficient specification
zonecfg:z1:fs> end
zonecfg:z1> verify
zonecfg:z1> info
zonepath: /zones/z1
autoboot: true
pool:
inherit-pkg-dir:
dir: /lib
inherit-pkg-dir:
dir: /platform
inherit-pkg-dir:
dir: /sbin
inherit-pkg-dir:
dir: /usr
fs:
dir: /cdrom
special: /cdrom
raw not specified
type: l
options: [nodevices]
net:
address: 192.168.1.2
physical: eri0
device
match: /dev/md/rdsk/d43
device
match: /dev/md/dsk/d43
zonecfg:z1>
zonecfg:z1> commit

Note: If CD-ROM access is granted to a zone, other zones should not be configured to access the same CD-ROM drive.

 Posted by at 7:56 pm