Tuesday, January 17, 2017

How to create or increase a swap partition on Solaris

In this post, I will explain to you, how to create or increase a swap partition on Solaris operating system. Swap partition is more useful file system which is used on Solaris as a virtual memory. Once the resource memory utilization get full, then swap memory comes in the role which maintain the server performance on the Solaris operating system.

If your Solaris server is connected to SAN storage then we will create a extra swap partition with storage. Normally ZFS file system we are using in Solaris operating system. By default swap partition which we created during Solaris OS installation is use rpool. In my case we are using SAN storage space to create the new swap partition.

Step by Step method of creation of swap partition:

1. First you can check the current swap space with below command.

     sun#swap -l
     swapfile             dev    swaplo   blocks     free
     /dev/zvol/dsk/rpool/swap 228,1        16  8388592  5850576

If you see the the output, only one "swap" named file is created on the server.

Note: this is default swap partition which we created during OS installation.

2. Now I want to increase my swap partition. for this please run the below command.

    sun#zfs create –V 64G san/swap1

    sun#swap –a /dev/zvol/dsk/san/swap1

In above command, I will created the new swap file "swap1" with 64 GB.

3. Swap partition is created now, you can check the status by below command
 
    sun#swap -l

4. For permamnent entry please add this file system in /etc/vfstab

/dev/zvol/dsk/san/swap1 -       -       swap    -       no      -

Note: If after reboot or shutdown the server, swap space is not present then please check the /dev/zvol/dsk/san directory and found the swap file name after that run the below command

swap –a /dev/zvol/dsk/san/swap1

Hope, you like this post, In case of any query please comment on this post, I will try to resolve your problem asap.

7 comments:

  1. Hello,

    i try to create a swap partition on my solaris machine but i don't have san storage on the server, so can you pls tell me how we will create it.

    ReplyDelete
    Replies
    1. Hello,

      can you pls provide me "zpool status" command output.

      Regards

      Delete
    2. [solaris]# /sbin/zpool status
      pool: rpool
      state: ONLINE
      scan: resilvered 22.2G in 0h7m with 0 errors on Fri Jul 10 14:15:53 2015
      config:

      NAME STATE READ WRITE CKSUM
      rpool ONLINE 0 0 0
      mirror-0 ONLINE 0 0 0
      c2t0d0s0 ONLINE 0 0 0
      c2t1d0s0 ONLINE 0 0 0

      errors: No known data errors

      Delete
    3. Hello,

      You can create the swap partition using below command for rpool.
      #zfs create -V 1G rpool/swap1
      #swap –a /dev/zvol/dsk/rpool/swap1

      Delete
  2. Thanks for help. Its works for me!!

    ReplyDelete
  3. Can you please provide me steps for increasing file system size in red hat linux
    Regards

    ReplyDelete