Add a tape device to a non global zone

To configure access to the tape drive device for a non-global zone do the
following:

# zonecfg -z dracko
zonecfg:dracko> add device
zonecfg:dracko:device> set match=/dev/rmt/0n
zonecfg:dracko:device> end
zonecfg:dracko> exit

The above set of commands adds a tape drive to a non-global zone.

Next, restart the non-global zone to make the configuration changes effective.

# zoneadm -z dracko reboot

After reboot the non-global zone can access to device /dev/rmt/0n and for
example check the status.

Backup ZFS to tape in a non-global zone

Backup ZFS to tape in a non-global zone

To configure access to the tape drive device for a non-global zone do the
following:

# zonecfg -z dracko
zonecfg:dracko> add device
zonecfg:dracko:device> set match=/dev/rmt/0n
zonecfg:dracko:device> end
zonecfg:dracko> exit

The above set of commands adds a tape drive to a non-global zone.

Next, restart the non-global zone to make the configuration changes effective.

# zoneadm -z dracko reboot

After reboot the non-global zone can access to device /dev/rmt/0n and for
example check the status.

now do a ZFS snapshot

zfs snapshot pool1/@mysnap

zfs send pool1/@mysnap > /dev/rmt/0n
zfs destroy pool1/@mysnap

Please note that ZFS send doesn?t handle EOT (End Of Tape) at all. If you write past the end of the tape things break down.

John Core
Technical Support Engineer
Sun Microsystems Inc.
dax@sun.com -or- john.core@sun.com

Create a minimal Zone on Solaris 10

This is a quick and dirty howto on creating Solaris 10 zones. If you just want to try it on a test environment or if you have studied http://docs.sun.com/app/docs/doc/817-1592 long enough to know what you want, you will find the commands to get it running. Do not use this as your only source of information for a procution environment!

I call the zone "testzone" and install it into /export/testzone. You may choose the zonename and path freely.

Create a directory for your zone- root.

mkdir -p /export/testzone
chmod 0700 /export/testzone
chown root:root /export/testzone

Do not use a zfs filesystem for your zone root!

Use zonecfg to Configure your zone

zonecfg -z testzone

* First you have to create the Config:
create
* Set the zonepath
set zonepath=/export/testzone
* Determine, whether the zone should boot when the box gets booted
set autoboot=true
* Add network devices
add net
set address=192.168.1.10
set physical=ce0
end
* Verify and save the configuration
verify
commit
exit

This is it. You have your own Solaris 10 zone configured. By now, you do not have any ressource controls attached and this zone is inheriting the following directories from the root zone:

/lib
/platform
/sbin
/usr

This means, you won’t be able to write into these directories if logged into the zone. But your zone will need much less disk space and updating will be much easier and quicker. So consider what you need.
Within zonecfg, you can remove any of these inherited directories with remove inherit-pkg-dir dir=/sbin

Any ressource control can be added later, so do not bother with them now.

Now tell you box to install the zone:
zoneadm -z testzone install (This will take a while)

Now boot your box for the first time
zoneadm -z testzone boot

Log into the Console of the Zone
zlogin -C testzone (You can leave with ~~. – Remember that, according to your typeset, you may have to type ~[space]~[space]. or it won’t work)

You may now configure the zone like any other Solaris 10 box. After the first time, you may use zlogin testzone to log in like it was ssh.

aphrodite /# mkdir -p /export/testzone
aphrodite /# chmod 0700 /export/testzone/
aphrodite /# zonecfg -z testzone
testzone: No such zone configured
Use ‘create’ to begin configuring a new zone.
zonecfg:testzone> create
zonecfg:testzone> set zonepath=/export/testzone
zonecfg:testzone> set autoboot=true
zonecfg:testzone> add net
zonecfg:testzone:net> set address=141.201.38.150
zonecfg:testzone:net> set physical=bge0
zonecfg:testzone:net> end
zonecfg:testzone> verify
zonecfg:testzone> commit
zonecfg:testzone> exit
aphrodite /# zoneadm -z testzone install
aphrodite /# zoneadm -z testzone boot
aphrodite /# zlogin -C testzone

Steps to create a simple Zone on Solaris

Create your first Container:

1) Where will the Container reside?

# mkdir -p /export/zones

I decided to install my Zone into /export/zones

2) Configure the Container:

Command zonecfg, located in /usr/sbin like all other Zone Commands, is used to configure the Container.

The Zone name will be sol10zone. Feel free to change the name if desired.

# zonecfg -z sol10zone
sol10zone: No such zone configured (normal message)
Use ‘create’ to begin configuring a new zone.
zonecfg:sol10zone> create
zonecfg:sol10zone> set zonepath=/export/zones/sol10zone
zonecfg:sol10zone> set autoboot=true
zonecfg:sol10zone> add net
zonecfg:sol10zone:net> set physical=hme0
zonecfg:sol10zone:net> set address=129.148.195.32 (use unique ip address!)
zonecfg:sol10zone:net> end
zonecfg:sol10zone> verify
zonecfg:sol10zone> exit
#

Now your Container is setup but not yet installed with Solaris [TM] 10 OE.

3) Install the Container:

# zoneadm -z sol10zone install
Preparing to install zone .
Creating list of files to copy from the global zone.
Copying <94677> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <1283> packages on the zone.
Initialized <1283> packages on zone.
Zone is initialized.
Installation of <1> packages was skipped.
The file contains a log of the zone installation.

Note that zoneadm is located in /usr/sbin as well.

4) Boot the Container:

# zoneadm -z sol10zone boot

5) Connect to the Console of your Container:

# zlogin -C sol10zone
[Connected to zone ‘sol10zone’ console]

Press return. (can take several mins)

Now, respond to some basic questions of a Solaris [TM] installation, such as:

o Define the Locale
o Define the Term
o Define the TZ
o Define the root password
o Define the Name Service

Once this is done, the Container will perform a final reboot:

rebooting system due to change(s) in /etc/default/init

[NOTICE: Zone rebooting]

SunOS Release 5.10 Version Generic 64-bit
Copyright 1983-2005 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
Hostname: sol10zone

sol10zone console login:

6) Log into the Container:

# zlogin -C sol10zone
[Connected to zone ‘sol10zone’ console]

sol10zone console login: root
Password:
Last login: Wed Feb 9 12:06:08 on console
Feb 9 12:46:23 sol10zone login: ROOT LOGIN /dev/console
Sun Microsystems Inc. SunOS 5.10 Generic January 2005

# ifconfig -a
lo0:1: flags=2001000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
hme0:1: flags=1000843 mtu 1500 index 2
inet 10.16.10.254 netmask ff000000 broadcast 10.255.255.255

# uname -a
SunOS sol10zone 5.10 Generic sun4u sparc SUNW,Ultra-5_10

You are now done.

Create a minimal Zone on Solaris 10

This is a quick and dirty howto on creating Solaris 10 zones. If you just want to try it on a test environment or if you have studied http://docs.sun.com/app/docs/doc/817-1592 long enough to know what you want, you will find the commands to get it running. Do not use this as your only source of information for a procution environment!

I call the zone "testzone" and install it into /export/testzone. You may choose the zonename and path freely.

Create a directory for your zone- root.

mkdir -p /export/testzone
chmod 0700 /export/testzone
chown root:root /export/testzone

Do not use a zfs filesystem for your zone root!

Use zonecfg to Configure your zone

zonecfg -z testzone

* First you have to create the Config:
create
* Set the zonepath
set zonepath=/export/testzone
* Determine, whether the zone should boot when the box gets booted
set autoboot=true
* Add network devices
add net
set address=192.168.1.10
set physical=ce0
end
* Verify and save the configuration
verify
commit
exit

This is it. You have your own Solaris 10 zone configured. By now, you do not have any ressource controls attached and this zone is inheriting the following directories from the root zone:

/lib
/platform
/sbin
/usr

This means, you won’t be able to write into these directories if logged into the zone. But your zone will need much less disk space and updating will be much easier and quicker. So consider what you need.
Within zonecfg, you can remove any of these inherited directories with remove inherit-pkg-dir dir=/sbin

Any ressource control can be added later, so do not bother with them now.

Now tell you box to install the zone:
zoneadm -z testzone install (This will take a while)

Now boot your box for the first time
zoneadm -z testzone boot

Log into the Console of the Zone
zlogin -C testzone (You can leave with ~~. – Remember that, according to your typeset, you may have to type ~[space]~[space]. or it won’t work)

You may now configure the zone like any other Solaris 10 box. After the first time, you may use zlogin testzone to log in like it was ssh.

aphrodite /# mkdir -p /export/testzone
aphrodite /# chmod 0700 /export/testzone/
aphrodite /# zonecfg -z testzone
testzone: No such zone configured
Use ‘create’ to begin configuring a new zone.
zonecfg:testzone> create
zonecfg:testzone> set zonepath=/export/testzone
zonecfg:testzone> set autoboot=true
zonecfg:testzone> add net
zonecfg:testzone:net> set address=141.201.38.150
zonecfg:testzone:net> set physical=bge0
zonecfg:testzone:net> end
zonecfg:testzone> verify
zonecfg:testzone> commit
zonecfg:testzone> exit
aphrodite /# zoneadm -z testzone install
aphrodite /# zoneadm -z testzone boot
aphrodite /# zlogin -C testzone

Steps to create a simple Zone on Solaris

Create your first Container:

1) Where will the Container reside?

# mkdir -p /export/zones

I decided to install my Zone into /export/zones

2) Configure the Container:

Command zonecfg, located in /usr/sbin like all other Zone Commands, is used to configure the Container.

The Zone name will be sol10zone. Feel free to change the name if desired.

# zonecfg -z sol10zone
sol10zone: No such zone configured (normal message)
Use ‘create’ to begin configuring a new zone.
zonecfg:sol10zone> create
zonecfg:sol10zone> set zonepath=/export/zones/sol10zone
zonecfg:sol10zone> set autoboot=true
zonecfg:sol10zone> add net
zonecfg:sol10zone:net> set physical=hme0
zonecfg:sol10zone:net> set address=129.148.195.32 (use unique ip address!)
zonecfg:sol10zone:net> end
zonecfg:sol10zone> verify
zonecfg:sol10zone> exit
#

Now your Container is setup but not yet installed with Solaris [TM] 10 OE.

3) Install the Container:

# zoneadm -z sol10zone install
Preparing to install zone .
Creating list of files to copy from the global zone.
Copying <94677> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <1283> packages on the zone.
Initialized <1283> packages on zone.
Zone is initialized.
Installation of <1> packages was skipped.
The file contains a log of the zone installation.

Note that zoneadm is located in /usr/sbin as well.

4) Boot the Container:

# zoneadm -z sol10zone boot

5) Connect to the Console of your Container:

# zlogin -C sol10zone
[Connected to zone ‘sol10zone’ console]

Press return. (can take several mins)

Now, respond to some basic questions of a Solaris [TM] installation, such as:

o Define the Locale
o Define the Term
o Define the TZ
o Define the root password
o Define the Name Service

Once this is done, the Container will perform a final reboot:

rebooting system due to change(s) in /etc/default/init

[NOTICE: Zone rebooting]

SunOS Release 5.10 Version Generic 64-bit
Copyright 1983-2005 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
Hostname: sol10zone

sol10zone console login:

6) Log into the Container:

# zlogin -C sol10zone
[Connected to zone ‘sol10zone’ console]

sol10zone console login: root
Password:
Last login: Wed Feb 9 12:06:08 on console
Feb 9 12:46:23 sol10zone login: ROOT LOGIN /dev/console
Sun Microsystems Inc. SunOS 5.10 Generic January 2005

# ifconfig -a
lo0:1: flags=2001000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
hme0:1: flags=1000843 mtu 1500 index 2
inet 10.16.10.254 netmask ff000000 broadcast 10.255.255.255

# uname -a
SunOS sol10zone 5.10 Generic sun4u sparc SUNW,Ultra-5_10

You are now done.