Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
$ ssh admin@<your ip>


Creating dpkg zone from zfs stream


use the zfs list command to find a dataset with your zone:

Code Block
languagebash
titlezfs list
#sudo zfs list | grep t4

rpool/zones/t4            400M  27.0G     31.5K  /zones/build_zone
rpool/zones/t4/ROOT       400M  27.0G       24K  legacy
rpool/zones/t4/ROOT/zbe   400M  27.0G      400M  legacy

now using zfs get all you need to find the active be for this zone:

Code Block
languagebash
titlezfs get all
#sudo zfs get all | grep t4

rpool/zones/t4/ROOT/zbe                   org.opensolaris.libbe:active    on                                                local
rpool/zones/t4/ROOT/zbe                   org.opensolaris.libbe:parentbe  fea60694-a58d-4828-be5d-6e8b39f64c44              local

after finding the active dataset, you can create a snapshot:

Code Block
languagebash
#sudo zfs snapshot  rpool/zones/t4/ROOT/zbe@copy_t4

#sudo zfs list -t | grep zbe@copy_t4

rpool/zones/build_zone/ROOT/zbe@check_dpkg           0B      -      400M  

#sudo zfs send rpool/zones/t4/ROOT/zbe@copy_t4 > /var/tmp/copy_t4.zfs

now you need to prepare the dataset for copying the zone:

Code Block
languagebash
#sudo zfs create -o mountpoint=/zones/copy_t4 rpool/zones/copy_t4

#mkdir -p /zones/copy_t4/root

#chmod 700 /zones/copy_t4

#chmod 755 /zones/copy_t4/root

#sudo zfs create -o mountpoint=legacy rpool/zones/copy_t4/ROOT

#sudo zfs create -o mountpoint=legacy rpool/zones/copy_t4/ROOT/zbe

now you need to export the zone configuration to a file:

Code Block
languagebash
#sudo zonecfg -z t4 export -f /var/tmp/copy_t4.cmd

#cat /var/tmp/copy_t4.cmd

create -b
set zonepath=/zones/t4
set brand=dpkg
set autoboot=false
set ip-type=exclusive
set uuid=da66d114-f97b-4b2b-a969-219ebcf56a19
add fs
set dir="/export/home/admin"
set special="/export/home/admin"
set type="lofs"
end
add fs
set dir="/export/builds"
set special="/export/builds"
set type="lofs"
end
add net
set physical="vnic1"
set mac-addr="02:08:20:1b:ea:6b"
set global-nic="stub0"
add property (name=ip,value="192.168.0.1")
add property (name=netmask,value="255.255.255.0")
add property (name=gateway,value="192.168.0.254")
add property (name=primary,value="true")
end
add attr
set name="resolvers"
set type="string"
set value="192.168.0.254"
end

now let's change this configuration so that we can create a zone via zonecfg:

Code Block
languagebash
create -b
set zonepath=/zones/copy_t4
set brand=dpkg
set autoboot=false
set ip-type=exclusive
add fs
set dir="/export/home/admin"
set special="/export/home/admin"
set type="lofs"
end
add fs
set dir="/export/builds"
set special="/export/builds"
set type="lofs"
end
add net
set physical="vnic2"
set global-nic="stub0"
add property (name=ip,value="192.168.0.2")
add property (name=netmask,value="255.255.255.0")
add property (name=gateway,value="192.168.0.254")
add property (name=primary,value="true")
end
add attr
set name="resolvers"
set type="string"
set value="192.168.0.254"
end

now use the zonecfg and zoneadm commands to create and start a zone:

Code Block
languagebash
#zonecfg -z copy_t4 -f /var/tmp/copy_t4.cmd

#zoneadm -z copy_t4 install -u -a /var/tmp/copy_t4.zfs

#zoneadm -z copy_t4 boot