HOWTO: Add and Use a Tape Drive in a Zone

/howto-add-and-use-a-tape-drive-in-a-zone 2007-03-09T16:46:20+00:00

This is just a quick one that may come in handy to someone, or me again in the future.

Adding a tape drive to a zone is quite a quick simple process.

  1. Add the device to the zone configuration from the global zone:
    [devon:~] # zonecfg -z myzone
    zonecfg:myzone> add device
    zonecfg:myzone:device> set match=/dev/rmt/0n
    zonecfg:myzone:device> end
    zonecfg:myzone> verify
    zonecfg:myzone> commit
    zonecfg:myzone> exit
    [devon:~] #
  2. Reboot the zone:
    [devon:~] # zoneadm -z myzone reboot

    You need to reboot the zone, because devfsadm doesn't work in a local zone:

    [myzone:~] # devfsadm
    devfsadm: open failed for /dev/.devfsadm_dev.lock: Permission denied
    [myzone:~] # mt status
    /dev/rmt/0n: No such file or directory
    [myzone:~] #

Once the local zone has rebooted, you should now have access to your tape drive and be able to use it as normal:

[myzone:~] # mt status
HP DDS-4 DAT (Sun) tape drive:
  sense key(0x0)= No Additional Sense   residual= 0   retries= 0
  file no= 0   block no= 0
[myzone:~] # tar -cvf /dev/rmt/0n var
a var/ 0 tape blocks
a var/sadm/ 0 tape blocks
a var/sadm/system/ 0 tape blocks
a var/sadm/system/logs/ 0 tape blocks
a var/sadm/system/logs/install_log 115 tape blocks
a var/sadm/system/logs/sysidtool.log 37 tape blocks
[...]
[myzone:~] # mt rewind
[myzone:~] # tar -tvf /dev/rmt/0n
drwxr-xr-x   0/3        0 Feb 14 16:53 2007 var/
drwxr-xr-x   0/3        0 Sep 28 12:46 2006 var/sadm/
drwxr-xr-x   0/3        0 Apr 18 09:27 2006 var/sadm/system/
drwxr-xr-x   0/3        0 Feb 14 16:45 2007 var/sadm/system/logs/
-rw-r--r--   0/0    58510 Feb 14 16:35 2007 var/sadm/system/logs/install_log
[...]
[myzone:~] #

Just remember, you can only backup filesystems accessible from this zone.

Copyright © 2005 - 2018 Colin Seymour All rights reserved. Privacy Policy.
Check out the feed if you do the RSS/Atom thing.