|CentOS||How To||ALL||Swap Memory|
How to increase SWAP space on ScaleArc by adding a swap file.
To increase swap space by adding a swap file use the following procedure:
- Determine the size of the new swap file in megabytes and multiple by 1024 to determine the block size. For example, the block size of a 64 MB swap file is 65536.
- At a shell prompt as root, type the following command with count being equal to the desired block size:
[root@Node1 idb]# dd if=/dev/zero of=/swapfile bs=1024 count=65536
65536+0 records in
65536+0 records out
67108864 bytes (67 MB) copied, 0.237089 s, 283 MB/s
[root@Node1 idb]# ll /swapfile
-rw-r--r-- 1 root root 67108864 Jan 3 12:21 /swapfile
- Setup the swap file with the mkswap command:
[root@Node1 idb]# mkswap /swapfile
mkswap: /swapfile: warning: don't erase bootbits sectors
on whole disk. Use -f to force.
Setting up swapspace version 1, size = 65532 KiB
no label, UUID=5c3b80fc-61a5-4bb6-b686-38b4037c645b (This UUID is to be added to the /etc/fstab file in later step)
- To enable the swap file immediately but not automatically at boot time use the swapon command:
[root@Node1 ~]# swapon /swapfile
- After adding the new swap file and enabling it, verify it is enabled by viewing the output of the command
[root@Node1 ~]# swapon -sFilename Type Size Used Priority/dev/sdb1 partition 16771824 0 -1/swapfile file 65532 0 -2
- Here we can see that the /dev/sdb1 has Priority "-1" and /swapfile 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=5c3b80fc-61a5-4bb6-b686-38b4037c645b(The UUID generated in earlier step using the swapon command) swap swap defaults 0 0==> New Swap entry
UUID=9df99ddc-f13a-4e1c-95e4-40eaca6fb1fc 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
/swapfile file 65532 0 -1
/dev/sdb1 partition 16771824 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
total used free shared buffers cached
Mem: 3924276 2006240 1918036 8920 19012 115560
-/+ buffers/cache: 1871668 2052608
Swap: 16837356 0 16837356
This way we can 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 email@example.com.
2901 Tasman Drive Santa Clara, CA 95054 | Email: firstname.lastname@example.org