{"id":1713,"date":"2023-09-08T08:16:59","date_gmt":"2023-09-08T08:16:59","guid":{"rendered":"https:\/\/www.dedicatedcore.com\/blog\/?p=1713"},"modified":"2025-01-15T09:26:55","modified_gmt":"2025-01-15T09:26:55","slug":"add-swap-space-ubuntu","status":"publish","type":"post","link":"https:\/\/www.dedicatedcore.com\/blog\/add-swap-space-ubuntu\/","title":{"rendered":"How to Add Swap Space on Ubuntu 16.04 | 18.04"},"content":{"rendered":"<p data-block-id=\"fcf8224f-94d1-4df5-af93-82f0c9eccf80\" data-pm-slice=\"1 1 []\">On Ubuntu 16.04, swap space can be quite important for maximizing system speed. particularly on systems with low amounts of physical memory. When physical RAM runs out, the system can temporarily store dormant memory pages in swap space, which functions as virtual memory.<\/p>\n<p data-block-id=\"cd5ae196-61cc-48b6-a2c5-0dacf57a39b3\">This tutorial will walk you through the process of adding swap space to your Ubuntu 16.04 system. It runs more smoothly and doesn&#8217;t crash because of memory issues. For the support of <a href=\"https:\/\/www.dedicatedcore.com\/blog\/install-anaconda-ubuntu\/\" target=\"_blank\" rel=\"noopener noreferrer nofollow\">data science and machine learning<\/a> for Python allocation, the anaconda is been used. As mentioned the purpose of anaconda installation is a task you need to understand in detail.<\/p>\n<h2>Examine the System for Information on Swaps<\/h2>\n<p>We can see if the system has any swap space available before we start. While it is possible to have more than one swap file or swap partition, one should suffice.<\/p>\n<p>Entering this will show us if the system has any swap configured:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ sudo swapon --show<\/pre>\n<p>If no output is returned, swap space is not currently available on your machine.<\/p>\n<p>You can use the following free utility to confirm that there isn&#8217;t an ongoing swap:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ free -h<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1715\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/swap-system-information.png\" alt=\"check system for swap info\" width=\"800\" height=\"169\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/swap-system-information.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/swap-system-information-300x63.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/swap-system-information-150x32.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/swap-system-information-768x162.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/swap-system-information-100x21.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/swap-system-information-700x148.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>The output&#8217;s &#8220;Swap&#8221; row shows you that the system is not currently in use for any swaps.<\/p>\n<h3>Examine the Hard Drive Partition&#8217;s Available Space.<\/h3>\n<p>Using a separate partition just to allocate space for swap is the most popular method. It isn&#8217;t always feasible to change the partitioning scheme, though. A swap file that is stored on an already-existing partition can be made just as simply.<\/p>\n<p>We should first type the following to see how much disk space is being used:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ df -h<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1717\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-check-available-space.png\" alt=\"check available space on partitoin\" width=\"800\" height=\"269\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-check-available-space.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-check-available-space-300x101.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-check-available-space-150x50.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-check-available-space-768x258.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-check-available-space-100x34.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-check-available-space-700x235.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>In this instance, the device under \/dev is our disk. In this scenario, we have plenty of space (only 1.1G used). You&#8217;ll most likely use it differently.<\/p>\n<p>The right size for a swap space is a matter of opinion, but ultimately it comes down to your preferences and the specifications of your application. Generally speaking, a decent starting point is to add twice as much RAM as your system has. Anything more than 4G of swap is generally unnecessary if you only use it as a RAM fallback, which is another wise maxim.<\/p>\n<h3>Make a Swap File.<\/h3>\n<p>We can create a swap file inside our filesystem now that we are aware of the amount of hard disk space that we have available. In our root (\/) directory, we will create a file called swapfile with the desired swap size. The fallocate software is the most effective method for producing a swap file. With this command, a file with a preallocated size is created quickly.<\/p>\n<p>As the server in our case has 512MB of RAM, we will use this approach to build a 1 Gigabyte file. Modify this to suit your own server&#8217;s requirements:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ sudo fallocate -l 1G \/swapfile<\/pre>\n<p>By typing: we can confirm that the appropriate quantity of space was reserved.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ ls -lh \/swapfile<\/pre>\n<p>We have allocated the appropriate amount of space when creating our file.<\/p>\n<h3>Activating the Swap File<\/h3>\n<p>We need to convert this into swap space now that we have a file available in the appropriate size. Initially, we must restrict the file&#8217;s permissions such that only users with root access can view its contents. This has serious security consequences because it keeps regular users from accessing the file.<\/p>\n<p>To restrict file access to only root, type:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ sudo chmod 600 \/swapfile<\/pre>\n<p>Type this to confirm the permissions change:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ ls -lh \/swapfile<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1718\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-enabling-swap-file.png\" alt=\"enabling swap file\" width=\"800\" height=\"130\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-enabling-swap-file.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-enabling-swap-file-300x49.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-enabling-swap-file-150x24.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-enabling-swap-file-768x125.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-enabling-swap-file-100x16.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-enabling-swap-file-700x114.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>As you can see, read and write flags are only enabled for the root user.<\/p>\n<p>The file can now be designated as swap space by typing:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ sudo mkswap \/swapfile<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1719\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-mkswap-command.png\" alt=\"mark file as swap\" width=\"800\" height=\"150\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-mkswap-command.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-mkswap-command-300x56.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-mkswap-command-150x28.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-mkswap-command-768x144.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-mkswap-command-100x19.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-mkswap-command-700x131.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>Once the file has been marked, we may activate the swap file so that our system can begin using it:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ sudo swapon \/swapfile<\/pre>\n<p>By typing:, we can confirm that the swap is available.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ sudo swapon --show<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1720\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-swapon-show-command.png\" alt=\"verify that swap is available\" width=\"800\" height=\"160\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-swapon-show-command.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-swapon-show-command-300x60.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-swapon-show-command-150x30.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-swapon-show-command-768x154.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-swapon-show-command-100x20.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-swapon-show-command-700x140.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>To confirm our conclusions, we can review the output of the free utility once more:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ free -h<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1721\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-free-h.png\" alt=\"check the output of free utility\" width=\"800\" height=\"169\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-free-h.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-free-h-300x63.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-free-h-150x32.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-free-h-768x162.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-free-h-100x21.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-free-h-700x148.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>After successfully configuring our swap, our operating system will use it when needed.<\/p>\n<h4>Set the swap file as a permanent one.<\/h4>\n<p>The swap file is now active for this session thanks to our recent modifications. But the server won&#8217;t automatically remember the swap settings if we reboot. By including the swap file in our \/etc\/fstab file, we can alter this.<\/p>\n<p>The \/etc\/fstab file should be backed up in case something goes wrong:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ sudo cp \/etc\/fstab \/etc\/fstab.bak<\/pre>\n<p>You can type the following to append the swap file information to the end of your \/etc\/fstab file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ echo '\/swapfile none swap sw 0 0' | sudo tee -a \/etc\/fstab<\/pre>\n<h4>Adjust the Swap Settings<\/h4>\n<p>When it comes to swapping, there are a few configuration choices that you may play with to see how your system performs.<\/p>\n<h4>Modifying the Swappiness Characteristic<\/h4>\n<p>The frequency at which your system moves data from RAM to the swap area is set by the swappiness option. A number between 0 and 100 is used to represent the percentage. The kernel won&#8217;t swap data to the disk unless it is required with values around zero. Recall that swap file interactions are &#8220;expensive&#8221; in the sense that they can significantly impair performance and take a lot longer than RAM interactions. In general, your system will operate faster if you tell it not to rely as much on the swap.<\/p>\n<p>To maintain more RAM-free space, values that are closer to 100 will attempt to swap out more data. This might be preferable in some circumstances, depending on the memory profile of your apps or the purpose of your server.<\/p>\n<p>By typing, we may view the swappiness value as of right now.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ cat \/proc\/sys\/vm\/swappiness<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1722\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-cat-swappiness.png\" alt=\"can see current swappiness value\" width=\"800\" height=\"150\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-cat-swappiness.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-cat-swappiness-300x56.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-cat-swappiness-150x28.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-cat-swappiness-768x144.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-cat-swappiness-100x19.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/command-cat-swappiness-700x131.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>A swappiness setting of 60 is not too bad for a desktop computer. You may want to shift the server closer to 0. Using the sysctl command, we can change the swappiness value.<\/p>\n<p>For example, we may type: to set the swappiness to 10.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ sudo sysctl vm.swappiness=10<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1723\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-sysctl-command.png\" alt=\"for instance to set the swappiness to 10\" width=\"800\" height=\"130\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-sysctl-command.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-sysctl-command-300x49.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-sysctl-command-150x24.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-sysctl-command-768x125.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-sysctl-command-100x16.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-sysctl-command-700x114.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>This configuration won&#8217;t change till the following reboot. We may add the following line to our \/etc\/sysctl.conf file to set this value automatically at restart:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ sudo nano \/etc\/sysctl.conf<\/pre>\n<p>At the end, you can include:<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1724\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-nano-command-1.png\" alt=\"at the bottom you can add\" width=\"800\" height=\"109\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-nano-command-1.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-nano-command-1-300x41.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-nano-command-1-150x20.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-nano-command-1-768x105.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-nano-command-1-100x14.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-nano-command-1-700x95.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>Close and save the file when you&#8217;re finished.<\/p>\n<h4>Changing the Cache Pressure Configuration<\/h4>\n<p>It is possible that you would also like to adjust the vfs_cache_pressure value. The amount that the system will prioritize caching inode and dentry information over other data is configured by this parameter.<\/p>\n<p>In essence, this is filesystem access data. It is sometimes very expensive to search and highly requested, so it is a great idea for your system to cache this. You may query the proc filesystem once more to see the current value:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ cat \/proc\/sys\/vm\/vfs_cache_pressure<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1725\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/cat-cache-pressure-command.png\" alt=\"adjusting the cache pressure setting\" width=\"800\" height=\"150\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/cat-cache-pressure-command.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/cat-cache-pressure-command-300x56.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/cat-cache-pressure-command-150x28.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/cat-cache-pressure-command-768x144.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/cat-cache-pressure-command-100x19.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/cat-cache-pressure-command-700x131.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>Our system deletes inode information from the cache as soon as it is right now. By typing: we can adjust this to a more cautious setting, such as 50.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ sudo sysctl vm.vfs_cache_pressure=50<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1726\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-sysctl-cache-pressure.png\" alt=\"output vm vfs cache pressure\" width=\"800\" height=\"149\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-sysctl-cache-pressure.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-sysctl-cache-pressure-300x56.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-sysctl-cache-pressure-150x28.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-sysctl-cache-pressure-768x143.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-sysctl-cache-pressure-100x19.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-sysctl-cache-pressure-700x130.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>Once more, this is exclusive to our present meeting. In the same way that we added our swappiness parameter to our configuration file, we can modify that:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ sudo nano \/etc\/sysctl.conf<\/pre>\n<p>Add the line with your revised value at the bottom:<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1727\" src=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-nano-cache-pressure.png\" alt=\"add line that value your new value\" width=\"800\" height=\"129\" srcset=\"https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-nano-cache-pressure.png 800w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-nano-cache-pressure-300x48.png 300w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-nano-cache-pressure-150x24.png 150w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-nano-cache-pressure-768x124.png 768w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-nano-cache-pressure-100x16.png 100w, https:\/\/www.dedicatedcore.com\/blog\/wp-content\/uploads\/sudo-nano-cache-pressure-700x113.png 700w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/strong><\/p>\n<p>Close and save the file when you&#8217;re finished.<\/p>\n<h4>Wrapping Up about How to Add Swap Space on Ubuntu<\/h4>\n<p>Finally, swap space addition for Ubuntu 16.04 is a simple procedure that can greatly improve system stability and speed, especially on systems with low physical memory. You can efficiently boost your system&#8217;s memory capacity, enabling more seamless multitasking and averting memory-related problems, by following the instructions provided in this guide. For a <a href=\"https:\/\/www.dedicatedcore.com\/blog\/install-elascticsearch-ubuntu\/\" target=\"_blank\" rel=\"noopener\">real-time search and analysis<\/a> of log data, Elasticsearch has been used and to understand the installation of Elasticsearch on Ubuntu one needs to follow the steps particularly.<\/p>\n<p>If you follow this guide&#8217;s instructions, you&#8217;ll be able to avoid out-of-memory exceptions in certain situations. Swap space is a very helpful tool for preventing some of these typical issues. Optimizing your application configurations or upgrading your server is the best course of action if you are experiencing OOM (out-of-memory) errors or if your system is not able to run the apps you require.<\/p>\n<h4 style=\"text-align: center;\">Frequently Asked Questions (FAQ)<\/h4>\n<p><strong>1. What is Swap Space?<\/strong><\/p>\n<p>It is a virtual memory file used by the operating system. It is used to extend physical RAM. When physical RAM is full, the system stores less frequently used data in swap space to free up RAM for more active processes.<\/p>\n<p><strong>2. Which method is better for Adding Swap Space?<\/strong><\/p>\n<p>There are two methods for adding swap space as follows:<\/p>\n<p><strong>Swap Files: <\/strong>Swap files are more flexible and easily resized but they have less performance than swap partitions.<\/p>\n<p><strong>Swap Partition: <\/strong>Swap partitions are more performant than swap files but they require proper planning and are not more flexible.<\/p>\n<p>So both have their advantages and disadvantages and you can choose which is better for your requirement.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>On Ubuntu 16.04, swap space can be quite important for maximizing system speed. particularly on systems with low amounts of physical memory. When physical RAM&#8230;<\/p>\n","protected":false},"author":1,"featured_media":1830,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/posts\/1713"}],"collection":[{"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/comments?post=1713"}],"version-history":[{"count":10,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/posts\/1713\/revisions"}],"predecessor-version":[{"id":2637,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/posts\/1713\/revisions\/2637"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/media\/1830"}],"wp:attachment":[{"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/media?parent=1713"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/categories?post=1713"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dedicatedcore.com\/blog\/wp-json\/wp\/v2\/tags?post=1713"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}