{"id":6105,"date":"2016-07-31T16:25:12","date_gmt":"2016-07-31T08:25:12","guid":{"rendered":"http:\/\/rmohan.com\/?p=6105"},"modified":"2016-07-31T16:25:49","modified_gmt":"2016-07-31T08:25:49","slug":"creating-a-swap-partition-in-rhel","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6105","title":{"rendered":"CREATING A SWAP PARTITION IN RHEL"},"content":{"rendered":"<p>In this demonstration, I will be adding at 2GB swap partition to \/dev\/sdb.<\/p>\n<p>You can identify the relevant disk which you wish to add the swap partition to from issuing the following command:<\/p>\n<p>[root@slave ~]# fdisk -l<br \/>\nTo add the swap partition, rerun the fdisk command with the relevant disk location:<\/p>\n<p>[root@slave ~]# fdisk \/dev\/sdb<br \/>\nType in \u201cn\u201d and press \u201cENTER\u201d until you reach a prompt asking for the \u201cLast sector\u201d size.<\/p>\n<p>Type in \u201c+2G\u201d and press \u201cENTER\u201c.<\/p>\n<p>Type in \u201ct\u201d and press \u201cENTER\u201c. For the hex code, enter in \u201c82\u201d and press \u201cENTER\u201c.<\/p>\n<p>Type in \u201cw\u201d and press \u201cENTER\u201d to activate the changes.<\/p>\n<p>Run partprobe next (this will save you rebooting the host).<\/p>\n<p>[root@slave ~]# partprobe<br \/>\nWe can now create the swap space.<\/p>\n<p>[root@slave ~]# mkswap \/dev\/sdb -f<br \/>\nmkswap: \/dev\/sdb: warning: wiping old swap signature.<br \/>\nSetting up swapspace version 1, size = 3145724 KiB<br \/>\nno label, UUID=7de886fb-d692-4783-8c17-11a871114ff9<br \/>\nCopy the above UUID.<\/p>\n<p>Enable the swap space:<\/p>\n<p>[root@slave ~]# swapon -a<br \/>\nModify the fstab to contain the new swap space.<\/p>\n<p>[root@slave ~]# vi \/etc\/fstab<br \/>\nUUID=7de886fb-d692-4783-8c17-11a871114ff9 swap swap defaults 0 0<br \/>\nI needed to reboot the host to make the changes live.<\/p>\n<p>[root@slave ~]# swapon -s<br \/>\nFilename                                Type            Size    Used    Priority<br \/>\n\/dev\/sdb                                partition       3145724 0       -1<br \/>\n\/dev\/dm-1                               partition       839676  0       -2<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this demonstration, I will be adding at 2GB swap partition to \/dev\/sdb.<\/p>\n<p>You can identify the relevant disk which you wish to add the swap partition to from issuing the following command:<\/p>\n<p>[root@slave ~]# fdisk -l To add the swap partition, rerun the fdisk command with the relevant disk location:<\/p>\n<p>[root@slave ~]# fdisk \/dev\/sdb [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6105"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6105"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6105\/revisions"}],"predecessor-version":[{"id":6106,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6105\/revisions\/6106"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}