Tuesday, 21 March 2017

Adding or Changing Swap Space in an Oracle Solaris 11.1

You should have root privileges to add or change swap sapce

1. Identify the current Swap Volume

# swap -l
swapfile                 dev  swaplo   blocks   free
/dev/zvol/dsk/rpool/swap 256,1      16 1058800 1058800

2. Select one of the following to resize the swap volume.

a.If the current swap area is not in use, you can resize the size of the current swap volume, but you must reboot the system to see the increased swap space.
For example:

# zfs get volsize rpool/swap
NAME        PROPERTY  VALUE    SOURCE
rpool/swap  volsize   517M     -
# zfs set volsize=2g rpool/swap
# zfs get volsize rpool/swap
NAME        PROPERTY  VALUE    SOURCE
rpool/swap  volsize   2G       -
# init 6
If the system cannot be rebooted, add another swap volume to increase your total swap space.
For example:

# zfs create -V 2G rpool/swap2
Then, activate the second swap volume.

# swap -a /dev/zvol/dsk/rpool/swap2
# swap -l
swapfile                  dev  swaplo   blocks   free
/dev/zvol/dsk/rpool/swap  256,1      16 1058800 1058800
/dev/zvol/dsk/rpool/swap2 256,3      16 4194288 4194288
If necessary, add an entry for the second swap volume in the /etc/vfstab file.
For example:

/dev/zvol/dsk/rpool/swap2    -        -       swap    -       no      -

No comments:

Post a Comment

Note: only a member of this blog may post a comment.