• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

UnixArena

  • Home
  • kubernetes
  • DevOps
    • Terraform
    • Jenkins
    • Docker
    • Openshift
      • OKD
    • Ansible engine
    • Ansible Tower
      • AWX
    • Puppet
  • Cloud
    • Azure
    • AWS
    • Openstack
    • Docker
  • VMware
    • vCloud Director
    • VMware-Guests
    • Vcenter Appliance 5.5
    • vC OPS
    • VMware SDDC
    • VMware vSphere 5.x
      • vSphere Network
      • vSphere DS
      • vShield Suite
    • VMware vSphere 6.0
    • VSAN
    • VMware Free Tools
  • Backup
    • Vembu BDR
    • Veeam
    • Nakivo
    • Azure Backup
    • Altaro VMBackup
    • Spinbackup
  • Tutorials
    • Openstack Tutorial
    • Openstack Beginner’s Guide
    • VXVM-Training
    • ZFS-Tutorials
    • NetApp cDot
    • LVM
    • Cisco UCS
    • LDOM
    • Oracle VM for x86
  • Linux
    • How to Articles
    • Q&A
    • Networking
    • RHEL7
  • DevOps Instructor-led Training
  • Contact

How to add new SWAP in Solaris 10 on fly

July 11, 2012 By Cloud_Devops 1 Comment

Rarely we may pushed in a such a situation to add the additional swap space while system is in production.Sometimes due to applications ,system may in to memory bottle neck.As a workaround,we will add additional swap space to avoid the system hung/panic.Here i would like to demonstrate couple of ways of adding swap.

1.Adding the physical disk directly as swap.
2.If we don;t have free disk, how to create swap space in ZFS and activate. 

Using dedicated physical disk:

To check current swap devices:

bash-3.00# swap -l
swapfile dev swaplo blocks free
/dev/zvol/dsk/rpool/swap 181,1 8 1048568 1048568

Here the free disk is c1t2d0 and adding as swap

bash-3.00# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c1t0d0
/pci@0,0/pci15ad,1976@10/sd@0,0
1. c1t1d0
/pci@0,0/pci15ad,1976@10/sd@1,0
2. c1t2d0
/pci@0,0/pci15ad,1976@10/sd@2,0
Specify disk (enter its number):

bash-3.00# swap -a /dev/dsk/c1t2d0s2

To check current swap devices:

bash-3.00# swap -l
swapfile dev swaplo blocks free
/dev/zvol/dsk/rpool/swap 181,1 8 1048568 1048568
/dev/dsk/c1t2d0s2 30,194 8 2091000 2091000
To add entry in Vfstab:
# vi /etc/vfstab
/dev/zvol/dsk/rpool/swap - - swap - no -
/dev/dsk/c1t2d0s2 - - swap - no -

To remove the added disk from swap space use the following command:

bash-3.00# swap -d /dev/dsk/c1t2d0s2

Note:You cannot deactivate when the swap in use. 

Always recommend to remove the additional swap from vfstab and reboot the server.

How can we add new swap to system using zfs dataset?
Create a  emulated zfs dataset for swap:
bash-3.00# zfs create -V 900M rpool/swap1

Listing zfs filesystems:

bash-3.00# zfs list
NAME USED AVAIL REFER MOUNTPOINT
rpool 4.59G 3.22G 34.5K /rpool
rpool/ROOT 3.58G 3.22G 21K legacy
rpool/ROOT/new_stage3 126K 3.22G 3.58G /.alt.new_stage3
rpool/ROOT/sol_stage2 3.58G 3.22G 3.57G /
rpool/ROOT/sol_stage2@new_stage3 1.53M - 3.58G -
rpool/dump 512M 3.22G 512M -
rpool/swap 528M 3.74G 16K -
swappool 929M 47.3M 21K /swappool
rpool/swap1 929M 929M 16K -

To activate New swap:

bash-3.00# swap -a /dev/zvol/dsk/rpool/swap1
bash-3.00# swap -l
swapfile dev swaplo blocks free
/dev/zvol/dsk/rpool/swap 181,1 8 1048568 1048568
/dev/zvol/dsk/swappool/swap1 181,3 8 1843192 1843192


After activating the swap,if you want to make it permanent then make sure you have added entry in vfstab for zfs swap.The same way you can deactivate the swap by removing it vfstab and rebooting the server.


Thank you for reading this article.Please leave a comment if you have any doubt ,i will get back to you as soon as possible.

Filed Under: Solaris 10

Reader Interactions

Comments

  1. santosh b says

    November 21, 2014 at 11:03 am

    how to increase the swapvol in vxvm

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Follow UnixArena

  • Facebook
  • LinkedIn
  • Twitter

Copyright © 2025 · UnixArena ·

Go to mobile version