{"id":8960,"date":"2024-07-17T14:38:12","date_gmt":"2024-07-17T14:38:12","guid":{"rendered":"https:\/\/www.webhi.com\/how-to\/?p=8960"},"modified":"2024-07-17T14:38:14","modified_gmt":"2024-07-17T14:38:14","slug":"how-to-create-and-configure-swap-on-linux-ubuntu-centos","status":"publish","type":"post","link":"https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/","title":{"rendered":"How to Create and Configure Swap on Linux (Ubuntu, CentOS)"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/07\/swap_linux_en.jpg\" alt=\"Create and Configure Swap on Linux Ubuntu CentOS\" class=\"wp-image-8970\" srcset=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/07\/swap_linux_en.jpg 1200w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/07\/swap_linux_en-300x169.jpg 300w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/07\/swap_linux_en-1024x576.jpg 1024w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/07\/swap_linux_en-768x432.jpg 768w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/07\/swap_linux_en-150x84.jpg 150w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<p>Creating and configuring <strong>swap<\/strong> space on a Linux system is an essential task for optimizing performance, particularly when physical RAM is insufficient. Swap space can be a dedicated partition or a swap file, both of which help manage memory more efficiently by providing additional virtual memory. This article will guide you through the process of creating and configuring swap on Ubuntu and CentOS, ensuring that your system runs smoothly even under heavy load.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"introduction-to-swap-space\">Introduction to Swap Space<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"what-is-swap-space\">What is Swap Space?<\/h3>\n\n\n\n<p>Swap space is a dedicated area on a storage device used by the operating system to supplement physical RAM. When the system&#8217;s RAM is fully utilized, the OS moves inactive pages to swap space, freeing up RAM for active processes. This helps in preventing crashes and maintaining system performance.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"importance-of-swap-space\">Importance of Swap Space<\/h3>\n\n\n\n<p>Swap space is crucial for system stability, particularly in environments with limited RAM. It provides a buffer against memory overflows, allowing the system to handle more applications and processes simultaneously. Swap space also supports hibernation, enabling the system to save its state and resume from where it left off.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"swap-space-in-linux\">Swap Space in Linux<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"types-of-swap-space\">Types of Swap Space<\/h3>\n\n\n\n<p>In Linux, swap space can be configured as a swap partition or a swap file. Both serve the same purpose but have different use cases and setup procedures.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"swap-partition-vs-swap-file\">Swap Partition vs. Swap File<\/h3>\n\n\n\n<ul>\n<li><strong>Swap Partition<\/strong>: A dedicated partition on the disk used exclusively for swap. It is generally faster and more reliable due to its fixed location on the disk.<\/li>\n\n\n\n<li><strong>Swap File<\/strong>: A regular file on the filesystem used for swap. It offers more flexibility as it can be resized or moved without repartitioning the disk.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"checking-current-swap-space\">Checking Current Swap Space<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"commands-to-check-swap-space\">Commands to Check Swap Space<\/h3>\n\n\n\n<p>To check the current swap space on your system, you can use the following commands:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ swapon --show\n$ free -h<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"interpreting-swap-space-information\">Interpreting Swap Space Information<\/h3>\n\n\n\n<p>The&nbsp;<code>swapon --show<\/code>&nbsp;command displays the currently active swap space, while&nbsp;<code>free -h<\/code>&nbsp;provides an overview of total, used, and free swap space. Understanding this information helps in managing and optimizing swap space effectively.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"creating-swap-partition-on-ubuntu\">Creating Swap Partition on Ubuntu<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"preparing-disk-for-swap-partition\">Preparing Disk for Swap Partition<\/h3>\n\n\n\n<p>Before creating a swap partition, ensure there is unallocated space on the disk. You can use tools like&nbsp;<code>gparted<\/code>&nbsp;to resize existing partitions if needed.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"creating-swap-partition-using-fdisk\">Creating Swap Partition Using&nbsp;<code>fdisk<\/code><\/h3>\n\n\n\n<ol>\n<li>Open a terminal and start&nbsp;<code>fdisk<\/code>:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo fdisk \/dev\/sdX<\/code><\/pre>\n\n\n\n<ol start=\"2\">\n<li>Create a new partition:\n<ul>\n<li>Press&nbsp;<code>n<\/code>&nbsp;for a new partition.<\/li>\n\n\n\n<li>Select the partition type (<code>primary<\/code>&nbsp;or&nbsp;<code>logical<\/code>).<\/li>\n\n\n\n<li>Specify the partition size.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Change the partition type to swap:\n<ul>\n<li>Press&nbsp;<code>t<\/code>&nbsp;to change the partition type.<\/li>\n\n\n\n<li>Enter&nbsp;<code>82<\/code>&nbsp;for Linux swap.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Write the changes and exit:\n<ul>\n<li>Press&nbsp;<code>w<\/code>&nbsp;to write changes and exit.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"formatting-the-swap-partition\">Formatting the Swap Partition<\/h3>\n\n\n\n<p>Format the new partition as swap:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo mkswap \/dev\/sdX1<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"activating-the-swap-partition\">Activating the Swap Partition<\/h3>\n\n\n\n<p>Activate the swap partition:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo swapon \/dev\/sdX1<\/code><\/pre>\n\n\n\n<p>To make the swap partition permanent, add it to&nbsp;<code>\/etc\/fstab<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ echo '\/dev\/sdX1 none swap sw 0 0' | sudo tee -a \/etc\/fstab<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"creating-swap-file-on-ubuntu\">Creating Swap File on Ubuntu<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"allocating-space-for-swap-file\">Allocating Space for Swap File<\/h3>\n\n\n\n<p>Create a swap file of the desired size (e.g., 2GB):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo fallocate -l 2G \/swapfile<\/code><\/pre>\n\n\n\n<p>If&nbsp;<code>fallocate<\/code>&nbsp;is not available, use&nbsp;<code>dd<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo dd if=\/dev\/zero of=\/swapfile bs=1M count=2048<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"setting-up-the-swap-file\">Setting Up the Swap File<\/h3>\n\n\n\n<p>Set the correct permissions:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo chmod 600 \/swapfile<\/code><\/pre>\n\n\n\n<p>Format the file as swap:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo mkswap \/swapfile<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"activating-the-swap-file\">Activating the Swap File<\/h3>\n\n\n\n<p>Activate the swap file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo swapon \/swapfile<\/code><\/pre>\n\n\n\n<p>To make the swap file permanent, add it to&nbsp;<code>\/etc\/fstab<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ echo '\/swapfile none swap sw 0 0' | sudo tee -a \/etc\/fstab<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"creating-swap-partition-on-centos\">Creating Swap Partition on CentOS<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"preparing-disk-for-swap-partition-1\">Preparing Disk for Swap Partition<\/h3>\n\n\n\n<p>Ensure there is unallocated space on the disk for the swap partition.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"creating-swap-partition-using-parted\">Creating Swap Partition Using&nbsp;<code>parted<\/code><\/h3>\n\n\n\n<ol>\n<li>Start&nbsp;<code>parted<\/code>:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo parted \/dev\/sdX<\/code><\/pre>\n\n\n\n<ol start=\"2\">\n<li>Create a new partition:\n<ul>\n<li>Use&nbsp;<code>mkpart<\/code>&nbsp;to create a new partition.<\/li>\n\n\n\n<li>Specify the partition type as&nbsp;<code>linux-swap<\/code>.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Set the partition type to swap:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo mkswap \/dev\/sdX1<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"formatting-the-swap-partition-1\">Formatting the Swap Partition<\/h3>\n\n\n\n<p>Format the partition as swap:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo mkswap \/dev\/sdX1<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"activating-the-swap-partition-1\">Activating the Swap Partition<\/h3>\n\n\n\n<p>Activate the swap partition:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo swapon \/dev\/sdX1<\/code><\/pre>\n\n\n\n<p>Add the swap partition to&nbsp;<code>\/etc\/fstab<\/code>&nbsp;to make it permanent:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ echo '\/dev\/sdX1 none swap sw 0 0' | sudo tee -a \/etc\/fstab<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"creating-swap-file-on-centos\">Creating Swap File on CentOS<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"allocating-space-for-swap-file-1\">Allocating Space for Swap File<\/h3>\n\n\n\n<p>Create a swap file of the desired size:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo fallocate -l 2G \/swapfile<\/code><\/pre>\n\n\n\n<p>Alternatively, use&nbsp;<code>dd<\/code>&nbsp;if&nbsp;<code>fallocate<\/code>&nbsp;is not available:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo dd if=\/dev\/zero of=\/swapfile bs=1M count=2048<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"setting-up-the-swap-file-1\">Setting Up the Swap File<\/h3>\n\n\n\n<p>Set the correct permissions:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo chmod 600 \/swapfile<\/code><\/pre>\n\n\n\n<p>Format the file as swap:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo mkswap \/swapfile<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"activating-the-swap-file-1\">Activating the Swap File<\/h3>\n\n\n\n<p>Activate the swap file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo swapon \/swapfile<\/code><\/pre>\n\n\n\n<p>Make the swap file permanent by adding it to&nbsp;<code>\/etc\/fstab<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ echo '\/swapfile none swap sw 0 0' | sudo tee -a \/etc\/fstab<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"configuring-swap-space\">Configuring Swap Space<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"making-swap-space-permanent\">Making Swap Space Permanent<\/h3>\n\n\n\n<p>Ensure that swap space is activated on boot by adding the appropriate entries to&nbsp;<code>\/etc\/fstab<\/code>. This file contains information about disk drives and partitions that the system uses during startup.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"adjusting-swappiness-value\">Adjusting Swappiness Value<\/h3>\n\n\n\n<p>Swappiness controls how aggressively the kernel swaps memory pages. It can be adjusted by editing&nbsp;<code>\/etc\/sysctl.conf<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo nano \/etc\/sysctl.conf<\/code><\/pre>\n\n\n\n<p>Add or modify the following line:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"properties\" class=\"language-properties\">vm.swappiness=10<\/code><\/pre>\n\n\n\n<p>Reload the configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo sysctl -p<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"monitoring-and-managing-swap-space\">Monitoring and Managing Swap Space<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"commands-to-monitor-swap-usage\">Commands to Monitor Swap Usage<\/h3>\n\n\n\n<p>Use the following commands to monitor swap usage:<\/p>\n\n\n\n<ul>\n<li><code>free -h<\/code><\/li>\n\n\n\n<li><code>swapon --show<\/code><\/li>\n\n\n\n<li><code>vmstat<\/code><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"managing-swap-space\">Managing Swap Space<\/h3>\n\n\n\n<p>To deactivate a swap space temporarily:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo swapoff \/swapfile<\/code><\/pre>\n\n\n\n<p>To reactivate it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo swapon \/swapfile<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"optimizing-system-performance-with-swap\">Optimizing System Performance with Swap<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"best-practices-for-swap-space\">Best Practices for Swap Space<\/h3>\n\n\n\n<ol>\n<li><strong>Allocate Adequate Swap Space<\/strong>: Generally, allocate swap space equal to or greater than your RAM.<\/li>\n\n\n\n<li><strong>Use SSDs for Faster Swap<\/strong>: If possible, use SSDs for swap space to benefit from faster read\/write speeds.<\/li>\n\n\n\n<li><strong>Monitor Regularly<\/strong>: Regularly check swap usage to ensure the system is not over-relying on swap, which can indicate insufficient RAM.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"performance-tuning-tips\">Performance Tuning Tips<\/h3>\n\n\n\n<ul>\n<li>Adjust the&nbsp;<code>swappiness<\/code>&nbsp;value based on your system&#8217;s workload. Lower values reduce swap usage, which can be beneficial for desktops, while higher values might be better for servers.<\/li>\n\n\n\n<li>Regularly clean up your system to free up RAM and reduce the need for swap.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"faqs-on-swap-space\">FAQs on Swap Space<\/h2>\n\n\n\n<p><strong>How much swap space do I need?<\/strong><\/p>\n\n\n\n<p>The recommended swap space is typically 1.5 to 2 times the amount of RAM, but this can vary based on system usage and available disk space.<\/p>\n\n\n\n<p><strong>Can I use swap space on SSD?<\/strong><\/p>\n\n\n\n<p>Yes, using swap space on an SSD can improve performance due to faster read\/write speeds compared to HDDs. However, be mindful of the SSD&#8217;s wear over time.<\/p>\n\n\n\n<p><strong>What happens if swap space runs out?<\/strong><\/p>\n\n\n\n<p>If swap space runs out, the system may start killing processes to free up memory, potentially leading to data loss. Ensuring sufficient swap space and monitoring usage is essential.<\/p>\n\n\n\n<p><strong>How do I increase swap space?<\/strong><\/p>\n\n\n\n<p>You can increase swap space by adding a new swap file or partition. For swap files, create a new file, format it as swap, and activate it.<\/p>\n\n\n\n<p><strong>How do I remove swap space?<\/strong><\/p>\n\n\n\n<p>To remove swap space, deactivate it with&nbsp;<code>swapoff<\/code>&nbsp;and remove the corresponding entry from&nbsp;<code>\/etc\/fstab<\/code>. Then, delete the swap file or partition.<\/p>\n\n\n\n<p><strong>Is swap space necessary with a lot of RAM?<\/strong><\/p>\n\n\n\n<p>Even with a lot of RAM, having some swap space is beneficial as a safety net and for hibernation support. It also helps manage memory more efficiently under heavy load.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n\n<p>Creating and configuring swap space on Linux systems, including Ubuntu and CentOS, is a crucial step in optimizing system performance and ensuring stability. By following the guidelines provided in this article, you can effectively manage memory and improve the overall efficiency of your system. Regular monitoring and appropriate configuration adjustments will help maintain optimal performance, allowing your system to handle demanding applications and processes with ease.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Creating and configuring swap space on a Linux system is an essential task for optimizing performance, particularly when physical RAM is insufficient. Swap space can be a dedicated partition or a swap file, both of which help manage memory more efficiently by providing additional virtual memory. This article will guide you through the process of ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[69,182],"tags":[],"yoast_head":"\n<title>How to Create and Configure Swap on Linux (Ubuntu, CentOS) - WebHi Tutorials &amp; Documentations<\/title>\n<meta name=\"description\" content=\"Learn how to create and configure swap on Linux systems, including Ubuntu and CentOS, with this comprehensive guide. Ensure optimal performance and manage memory effectively.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Create and Configure Swap on Linux (Ubuntu, CentOS) - WebHi Tutorials &amp; Documentations\" \/>\n<meta property=\"og:description\" content=\"Learn how to create and configure swap on Linux systems, including Ubuntu and CentOS, with this comprehensive guide. Ensure optimal performance and manage memory effectively.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/\" \/>\n<meta property=\"og:site_name\" content=\"WebHi Tutorials &amp; Documentations\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webhi.technology\" \/>\n<meta property=\"article:published_time\" content=\"2024-07-17T14:38:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-17T14:38:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/07\/swap_linux_en.jpg\" \/>\n<meta name=\"author\" content=\"webhi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@WebHiTechnology\" \/>\n<meta name=\"twitter:site\" content=\"@WebHiTechnology\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"webhi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/\"},\"author\":{\"name\":\"webhi\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54\"},\"headline\":\"How to Create and Configure Swap on Linux (Ubuntu, CentOS)\",\"datePublished\":\"2024-07-17T14:38:12+00:00\",\"dateModified\":\"2024-07-17T14:38:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/\"},\"wordCount\":1161,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\"},\"articleSection\":[\"Linux system administration\",\"Virtualization &amp; Cloud computing\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/\",\"name\":\"How to Create and Configure Swap on Linux (Ubuntu, CentOS) - WebHi Tutorials &amp; Documentations\",\"isPartOf\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#website\"},\"datePublished\":\"2024-07-17T14:38:12+00:00\",\"dateModified\":\"2024-07-17T14:38:14+00:00\",\"description\":\"Learn how to create and configure swap on Linux systems, including Ubuntu and CentOS, with this comprehensive guide. Ensure optimal performance and manage memory effectively.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webhi.com\/how-to\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Create and Configure Swap on Linux (Ubuntu, CentOS)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#website\",\"url\":\"https:\/\/www.webhi.com\/how-to\/\",\"name\":\"WebHi Tutorials &amp; Documentations\",\"description\":\"System administration and knowledge base\",\"publisher\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webhi.com\/how-to\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\",\"name\":\"WebHi Technology\",\"url\":\"https:\/\/www.webhi.com\/how-to\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png\",\"contentUrl\":\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png\",\"width\":288,\"height\":95,\"caption\":\"WebHi Technology\"},\"image\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webhi.technology\",\"https:\/\/twitter.com\/WebHiTechnology\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54\",\"name\":\"webhi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1781214743\",\"contentUrl\":\"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1781214743\",\"caption\":\"webhi\"},\"sameAs\":[\"https:\/\/www.webhi.com\/how-to\"],\"url\":\"https:\/\/www.webhi.com\/how-to\/author\/webhi\/\"}]}<\/script>\n","yoast_head_json":{"title":"How to Create and Configure Swap on Linux (Ubuntu, CentOS) - WebHi Tutorials &amp; Documentations","description":"Learn how to create and configure swap on Linux systems, including Ubuntu and CentOS, with this comprehensive guide. Ensure optimal performance and manage memory effectively.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/","og_locale":"en_US","og_type":"article","og_title":"How to Create and Configure Swap on Linux (Ubuntu, CentOS) - WebHi Tutorials &amp; Documentations","og_description":"Learn how to create and configure swap on Linux systems, including Ubuntu and CentOS, with this comprehensive guide. Ensure optimal performance and manage memory effectively.","og_url":"https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/","og_site_name":"WebHi Tutorials &amp; Documentations","article_publisher":"https:\/\/www.facebook.com\/webhi.technology","article_published_time":"2024-07-17T14:38:12+00:00","article_modified_time":"2024-07-17T14:38:14+00:00","og_image":[{"url":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/07\/swap_linux_en.jpg"}],"author":"webhi","twitter_card":"summary_large_image","twitter_creator":"@WebHiTechnology","twitter_site":"@WebHiTechnology","twitter_misc":{"Written by":"webhi","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/#article","isPartOf":{"@id":"https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/"},"author":{"name":"webhi","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54"},"headline":"How to Create and Configure Swap on Linux (Ubuntu, CentOS)","datePublished":"2024-07-17T14:38:12+00:00","dateModified":"2024-07-17T14:38:14+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/"},"wordCount":1161,"commentCount":0,"publisher":{"@id":"https:\/\/www.webhi.com\/how-to\/#organization"},"articleSection":["Linux system administration","Virtualization &amp; Cloud computing"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/","url":"https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/","name":"How to Create and Configure Swap on Linux (Ubuntu, CentOS) - WebHi Tutorials &amp; Documentations","isPartOf":{"@id":"https:\/\/www.webhi.com\/how-to\/#website"},"datePublished":"2024-07-17T14:38:12+00:00","dateModified":"2024-07-17T14:38:14+00:00","description":"Learn how to create and configure swap on Linux systems, including Ubuntu and CentOS, with this comprehensive guide. Ensure optimal performance and manage memory effectively.","breadcrumb":{"@id":"https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.webhi.com\/how-to\/how-to-create-and-configure-swap-on-linux-ubuntu-centos\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webhi.com\/how-to\/"},{"@type":"ListItem","position":2,"name":"How to Create and Configure Swap on Linux (Ubuntu, CentOS)"}]},{"@type":"WebSite","@id":"https:\/\/www.webhi.com\/how-to\/#website","url":"https:\/\/www.webhi.com\/how-to\/","name":"WebHi Tutorials &amp; Documentations","description":"System administration and knowledge base","publisher":{"@id":"https:\/\/www.webhi.com\/how-to\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webhi.com\/how-to\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webhi.com\/how-to\/#organization","name":"WebHi Technology","url":"https:\/\/www.webhi.com\/how-to\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/","url":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png","contentUrl":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png","width":288,"height":95,"caption":"WebHi Technology"},"image":{"@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webhi.technology","https:\/\/twitter.com\/WebHiTechnology"]},{"@type":"Person","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54","name":"webhi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/image\/","url":"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1781214743","contentUrl":"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1781214743","caption":"webhi"},"sameAs":["https:\/\/www.webhi.com\/how-to"],"url":"https:\/\/www.webhi.com\/how-to\/author\/webhi\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/8960"}],"collection":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/comments?post=8960"}],"version-history":[{"count":4,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/8960\/revisions"}],"predecessor-version":[{"id":8979,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/8960\/revisions\/8979"}],"wp:attachment":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/media?parent=8960"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/categories?post=8960"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/tags?post=8960"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}