Archive for October, 2011
Fixing “No active dataset” on zone attach
When moving zones between OpenIndiana (and OpenSolaris) hosts, you can often end up with the following dreaded error:
# zoneadm -z zonename attach -U
Log File: /var/tmp/zonename.attach_log.B8aWed
ERROR: no active dataset.
Result: Attach Failed.
This can happen for a variety of reasons, such as not detaching the zone before moving it, and not transferring the ZFS properties with the zone. But personally I blame the half-arsed zone attach scripts that could do with some work.
To get around it, here is a super-quick/dirty script that should allow the zone to attach:
#!/bin/bash
zfsfs=$1
root=${zfsfs}/ROOT
zbe=${root}/zbe
for i in $zbe $root $zfsfs ; do
for j in zoned mountpoint ; do
zfs inherit $j $i
done
done
zfs set mountpoint=legacy $root
zfs set zoned=on $root
zfs set canmount=noauto $zbe
zfs set org.opensolaris.libbe:active=on $zbe
rbe=`zfs list -H -o name /`
uuid=`zfs get -H -o value org.opensolaris.libbe:uuid $rbe`
zfs set org.opensolaris.libbe:parentbe=$uuid $zbe
The script takes one argument, the zfs filesystem the zone lives in (the parent of “ROOT” for the zone). Ignore any errors about "dataset is used in a non-global zone", and once it has run, manually mount the dataset and attach it with:
mount -F zfs dataset/ROOT/zbe /zones/zonename/root zoneadm -z zonename attach
This guide is pretty rough but should hopefully set people in roughly the right direction.
4 comments October 31st, 2011
