Friday, February 22, 2013

sol11 zfs, swap & zone creation woes

I want to create a new sol10 zone on a sol11 sparc system.

I get a message stating that i don't have have memory.  Really?  Seriously?  What *are* they doing?

# swap -s -h

205M available. 

Whoops.  That's all me.

What to do?  Create a swap file.  Sure.  Let's do the usual, shall we?

# mkfile 5g /swap
# swap -a /swap
"/swap" may contain holes - can't swap on it.

Oh come on.  Silly zfs filesystem.  Sigh.

Well.  Let's see where we can put a swap file...

# zfs list

rpool/export                                           43.5G  68.4G    34K  /export
rpool/export/home                                      66K    68.4G    32K  /export/home
rpool/export/home/localuser                            34K    68.4G    34K  /export/home/localuser
rpool/export/zones                                     43.5G  68.4G    43K  /export/zones

Well.  zones looks as good a place as any.  So, it is a device; and the device is here:
We just know this because that's zfs.

Let's script it, shall we?  Just in case we need to do this again.  One shot.  Create it, activate it, mount it.

if [ ! -L /dev/zvol/dsk/rpool/export/zones/swap ]
       zfs create -V 5gb rpool/export/zones/swap
echo "/dev/zvol/dsk/rpool/export/zones/swap -  -  swap  -  no   -" >> /etc/vfstab
/usr/sbin/swap -a /dev/zvol/dsk/rpool/export/zones/swap
mount -a

# swap -s -h
total: 2.0G allocated + 1.3G reserved = 3.3G used, 5.3G available


And now the creation of that zone...
# ./solaris-10u10-sparc.bin -p /export/zones -a -z sol10vm


Post a Comment