{"id":1065,"date":"2025-10-14T11:43:05","date_gmt":"2025-10-14T09:43:05","guid":{"rendered":"https:\/\/anjo.pt\/keyword-oracle\/?p=1065"},"modified":"2025-10-14T11:43:06","modified_gmt":"2025-10-14T09:43:06","slug":"extend-swap-in-oracle-linux","status":"publish","type":"post","link":"https:\/\/anjo.pt\/keyword-oracle\/2025\/10\/14\/extend-swap-in-oracle-linux\/","title":{"rendered":"Extend Swap in Oracle Linux"},"content":{"rendered":"\n<p>The client has also configured a small Swap mountpoint, when looking at all memory available on the server. Oracle documentation says this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/anjo.pt\/keyword-oracle\/wp-content\/uploads\/sites\/3\/2025\/10\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"526\" height=\"106\" src=\"https:\/\/anjo.pt\/keyword-oracle\/wp-content\/uploads\/sites\/3\/2025\/10\/image.png\" alt=\"\" class=\"wp-image-1066\" srcset=\"https:\/\/anjo.pt\/keyword-oracle\/wp-content\/uploads\/sites\/3\/2025\/10\/image.png 526w, https:\/\/anjo.pt\/keyword-oracle\/wp-content\/uploads\/sites\/3\/2025\/10\/image-300x60.png 300w\" sizes=\"auto, (max-width: 526px) 100vw, 526px\" \/><\/a><\/figure>\n\n\n\n<p>The VM has 116GB memory, and 32GB reserved for HugePages. The actual swap mountpoint is 4GB big and, based on the Oracle Server Configuration Checklist for 19c, the swap mountpoint should be in this case 16GB.<\/p>\n\n\n\n<p>I\u2019m using Oracle Linux 9, xfs filesystems. I&#8217;ll increase the swap mountpoint online, with the databases running.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>Please check the previous two posts for information on Extending other partitions types:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/anjo.pt\/keyword-oracle\/2025\/09\/17\/extend-partition-from-vmware-in-oracle-linux-part-1\/\">Part 1 \u2013 extend mountpoint alone in a block device (\/u02 in the table below)<\/a>\u00a0\u2013 more detailed explanations<\/li>\n\n\n\n<li><a href=\"https:\/\/anjo.pt\/keyword-oracle\/2025\/09\/17\/extend-partition-from-vmware-in-oracle-linux-part-2\/\" data-type=\"post\" data-id=\"1054\">Part 2 \u2013 extend a specific mountpoint within several partitions in a block device (\/u01 in the table below)<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Increase swap mountpoint from 4GB to 16GB<\/h2>\n\n\n\n<p>The current status can be checked using both parted and lsblk. Parted uses base10 units which shows the as 831GB big, while lsblk uses base2 units, showing the \/dev\/sda as 774GiB big. From this only ~84GB are mapped (&#8220;End&#8221; of parted output). This means we have a lot of free disk, no action is needed in VMWare (see Part 1 blog post for more on this).?<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;root@vmware-vm01 ~]# parted \/dev\/sda print\nModel: VMware Virtual disk (scsi)\nDisk \/dev\/sda: 831GB\nSector size (logical\/physical): 512B\/512B\nPartition Table: gpt\nDisk Flags: \n\nNumber  Start   End     Size    File system  Name                  Flags\n 1      1049kB  263MB   262MB   fat16        EFI System Partition  boot, esp\n 2      263MB   1337MB  1074MB  xfs\n 3      1337MB  84.0GB  82.7GB                                     lvm\n\n&#x5B;root@vmware-vm01 ~]# lsblk -p \/dev\/sda\nNAME                                         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS\n\/dev\/sda                                       8:0    0   774G  0 disk \n\u251c\u2500\/dev\/sda1                                    8:1    0   250M  0 part \/boot\/efi\n\u251c\u2500\/dev\/sda2                                    8:2    0     1G  0 part \/boot\n\u2514\u2500\/dev\/sda3                                    8:3    0    77G  0 part \n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-root          252:0    0    10G  0 lvm  \/\n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-swap          252:1    0     4G  0 lvm  &#x5B;SWAP]\n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-var_log_audit 252:2    0     1G  0 lvm  \/var\/log\/audit\n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-u01           252:3    0    50G  0 lvm  \/u01\n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-home          252:4    0     5G  0 lvm  \/home\n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-var_log       252:5    0     2G  0 lvm  \/var\/log\n  \u2514\u2500\/dev\/mapper\/ol_vmware-vm01-var           252:6    0     5G  0 lvm  \/var\n<\/pre><\/div>\n\n\n<p>The Swap mountpoint is in the \/dev\/sda3 partition, which have several logical volumes. I need first to increase the size of this partition at least  by 12GiB (about 13GB) to hold a bigger swap mountpoint.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;root@vmware-vm01 ~]# parted \/dev\/sda &quot;resizepart 3 100G&quot;                     \nInformation: You may need to update \/etc\/fstab.\n\n&#x5B;root@vmware-vm01 ~]# lsblk -p \/dev\/sda                 \nNAME                                         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS\n\/dev\/sda                                       8:0    0   774G  0 disk \n\u251c\u2500\/dev\/sda1                                    8:1    0   250M  0 part \/boot\/efi\n\u251c\u2500\/dev\/sda2                                    8:2    0     1G  0 part \/boot\n\u2514\u2500\/dev\/sda3                                    8:3    0  91.9G  0 part \n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-root          252:0    0    10G  0 lvm  \/\n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-swap          252:1    0     4G  0 lvm  &#x5B;SWAP]\n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-var_log_audit 252:2    0     1G  0 lvm  \/var\/log\/audit\n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-u01           252:3    0    50G  0 lvm  \/u01\n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-home          252:4    0     5G  0 lvm  \/home\n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-var_log       252:5    0     2G  0 lvm  \/var\/log\n  \u2514\u2500\/dev\/mapper\/ol_vmware-vm01-var           252:6    0     5G  0 lvm  \/var\n<\/pre><\/div>\n\n\n<p>And resize the Physical Volume:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;root@vmware-vm01 ~]# pvresize \/dev\/sda3\n  Physical volume &quot;\/dev\/sda3&quot; changed\n  1 physical volume(s) resized or updated \/ 0 physical volume(s) not resized\n<\/pre><\/div>\n\n\n<p>Next, it is needed to deactivate temporarily swap. This should not be a problem when we have enough free memory. This operation takes a while.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;root@vmware-vm01 ~]# swapoff -a\n\n&#x5B;root@vmware-vm01 ~]# free -h\n               total        used        free      shared  buff\/cache   available\nMem:           114Gi        39Gi       1.5Gi       561Mi        74Gi        74Gi\nSwap:             0B          0B          0B\n<\/pre><\/div>\n\n\n<p>Now that swap mountpoint is not used, I can extend the size of the logical volume.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;root@vmware-vm01 ~]# lvextend --size +12G \/dev\/mapper\/ol_vmware-vm01-swap\n  Size of logical volume ol_vmware-vm01\/swap changed from 4.00 GiB (1024 extents) to 16.00 GiB (4096 extents).\n  Logical volume ol_vmware-vm01\/swap successfully resized.\n\n&#x5B;root@vmware-vm01 ~]# lsblk -p \/dev\/sda\nNAME                                         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS\n\/dev\/sda                                       8:0    0  774G  0 disk \n\u251c\u2500\/dev\/sda1                                    8:1    0  250M  0 part \/boot\/efi\n\u251c\u2500\/dev\/sda2                                    8:2    0    1G  0 part \/boot\n\u2514\u2500\/dev\/sda3                                    8:3    0 91.9G  0 part \n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-root          252:0    0   10G  0 lvm  \/\n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-swap          252:1    0   16G  0 lvm  \n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-var_log_audit 252:2    0    1G  0 lvm  \/var\/log\/audit\n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-u01           252:3    0   50G  0 lvm  \/u01\n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-home          252:4    0    5G  0 lvm  \/home\n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-var_log       252:5    0    2G  0 lvm  \/var\/log\n  \u2514\u2500\/dev\/mapper\/ol_vmware-vm01-var           252:6    0    5G  0 lvm  \/var  \n<\/pre><\/div>\n\n\n<p>And finally I can enable swap again. This means, assign the logical volume to swap usage:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;root@vmware-vm01 ~]# mkswap --label SWAP \/dev\/mapper\/ol_vmware-vm01-swap\nmkswap: \/dev\/mapper\/ol_vmware-vm01-swap: warning: wiping old swap signature.\nSetting up swapspace version 1, size = 16 GiB (17179865088 bytes)\nLABEL=SWAP, UUID=98a8b003-d33e-4c28-b1db-13b98b95ff4c\n\n&#x5B;root@vmware-vm01 ~]# swapon -a\n<\/pre><\/div>\n\n\n<p>Final result is here:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;root@vmware-vm01 ~]# free -h\n               total        used        free      shared  buff\/cache   available\nMem:           114Gi        39Gi       1.9Gi       561Mi        74Gi        74Gi\nSwap:           15Gi          0B        15Gi\n\n&#x5B;root@vmware-vm01 ~]# lsblk -p \/dev\/sda\nNAME                                         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS\n\/dev\/sda                                       8:0    0  774G  0 disk \n\u251c\u2500\/dev\/sda1                                    8:1    0  250M  0 part \/boot\/efi\n\u251c\u2500\/dev\/sda2                                    8:2    0    1G  0 part \/boot\n\u2514\u2500\/dev\/sda3                                    8:3    0 91.9G  0 part \n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-root          252:0    0   10G  0 lvm  \/\n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-swap          252:1    0   16G  0 lvm  &#x5B;SWAP]\n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-var_log_audit 252:2    0    1G  0 lvm  \/var\/log\/audit\n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-u01           252:3    0   50G  0 lvm  \/u01\n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-home          252:4    0    5G  0 lvm  \/home\n  \u251c\u2500\/dev\/mapper\/ol_vmware-vm01-var_log       252:5    0    2G  0 lvm  \/var\/log\n  \u2514\u2500\/dev\/mapper\/ol_vmware-vm01-var           252:6    0    5G  0 lvm  \/var\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>The client has also configured a small Swap mountpoint, when looking at all memory available on the server. Oracle documentation says this: The VM has 116GB memory, and 32GB reserved for HugePages. The actual swap mountpoint is 4GB big and, based on the Oracle Server Configuration Checklist for 19c, the swap mountpoint should be in [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35,39],"tags":[87],"class_list":{"0":"post-1065","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-linux","7":"category-oracle-19c","8":"tag-oracle-linux-9","9":"czr-hentry"},"_links":{"self":[{"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/posts\/1065","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/comments?post=1065"}],"version-history":[{"count":1,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/posts\/1065\/revisions"}],"predecessor-version":[{"id":1067,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/posts\/1065\/revisions\/1067"}],"wp:attachment":[{"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/media?parent=1065"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/categories?post=1065"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/tags?post=1065"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}