ScaleArc Support Center

Welcome back, guest

Register or login below.

Downloads

Feedback

How to increase SWAP size on ScaleArc by adding a new disk.

Release Classification Level DB Platform Categories
CentOS How To ALL Swap Memory

 

OBJECTIVE

How to increase SWAP size on ScaleArc by adding a new partition.

 

PROCEDURE

Sometimes it is necessary to add more swap space after installation. For example, you may upgrade the amount of RAM in your system from 1 GB to 4GB, but there is only 2GB of swap space. It might be advantageous to increase the amount of swap space to 8GB if you perform memory-intense operations or run applications that require a large amount of memory.

It is recommended that you add a swap partition, but that can be difficult if you do not have any free space available. We can add a new disk to the machine and create a partition and mount it to swap as follows:

 

  • Run fdisk disk_name. 
[root@Node1 ~]# fdisk /dev/sdb
  • Use the option "n" to create a new partition.
Note: It is recommended to follow fdisk’s defaults as the default values (for example, the first partition sectors) and partition sizes specified are always aligned according to the device properties.
 
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2088, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-2088, default 2088):
Using default value 2088
  • Check the partition table to ensure that the partitions are created as required using the "p" option.
Command (m for help): p
Disk /dev/sdb: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x7d795f1a
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        2088    16771828+  83  Linux
  • Write the changes with the "w" option when you are sure they are correct.
Command (m for help): w
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
Syncing disks.
  • Now we will change the new partition /dev/sdb1 type to Linux Swap(82).
[root@Node1 ~]# fdisk /dev/sdb1
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 82
Changed system type of partition 1 to 82 (Linux swap / Solaris)
  • We can verify the change using "p":
Command (m for help): p
 
Disk /dev/sdb: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x7d795f1a
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        2088    16771828+  82  Linux swap / Solaris

  • Write the change using "w":
Command (m for help): w
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
 
WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
  • Now that you have created the swap partition, use the command mkswap to setup the swap partition. At a shell prompt as root, type the following:
[root@Node1 ~]# mkswap /dev/sdb1
Setting up swapspace version 1, size = 16771824 KiB
no label, UUID=9df99ddc-f13a-4e1c-95e4-40eaca6fb1fc (This UUID is to be added to the /etc/fstab file in later step)
  • To enable the swap partition immediately, type the swapon command:
[root@Node1 ~]# swapon /dev/sdb1
  • After adding the new swap partition and enabling it, verify it is enabled by viewing the output of the following command:
[root@Node1 ~]# swapon -s
Filename                                Type            Size    Used    Priority
/dev/sda2                               partition       4056060 0       -1
/dev/sdb1                               partition       16771824        0       -2
  • Here we can see that the /dev/sda2 has Priority "-1" and /dev/sdb1 has priority "-2"
  • To change the priority of /dev/sdb1 as "-1", we will add the partition entry to "/etc/fstab".
  • Please note that the priority of swap partition is assigned as per the order of entries in /etc/fstab file. Open the /etc/fstab file and edit the entries as follows:
UUID=9df99ddc-f13a-4e1c-95e4-40eaca6fb1fc(The UUID generated in earlier step using the swapon command) swap                   swap    defaults        0 0==> New Swap partition entry
UUID=919f01fb-d3e2-4c3d-9bb7-3bbc05878dea swap                   swap    defaults        0 0==> Previous Swap partition entry

 

  • Save the file and reboot the system.
  • Once the system us UP, check the swap details again using:
[root@Node1 ~]# swapon -s
Filename                                Type            Size    Used    Priority
/dev/sdb1                               partition       16771824        0       -1
/dev/sda2                               partition       4056060 0       -2
  • Thus we can see that the new partition is having the higest priority. Now can confirm the total Swap memory assigned in the system using "free":
 
[root@Node1 ~]# free -g
             total       used       free     shared    buffers     cached
Mem:             3          1          1          0          0          0
-/+ buffers/cache:          1          1
Swap:           19          0         19

 

 This process can be used add extra Swap space to ScaleArc.


If you are experiencing issues with ScaleArc or with any of it's features, please contact ScaleArc Support. We are available 24x7 by phone at 855 800 7225 or +1 408 412 7315. For general support inquiries, you can also e-mail us at support@scalearc.com.

Copyright ©2014 ScaleArc, Inc. All rights reserved. Contact Support |  Contact ScaleArc |  Feedback

2901 Tasman Drive Santa Clara, CA 95054 | Email:  support@scalearc.com

Permalink: https://support.scalearc.com/kb/articles/4042