{"id":29132,"date":"2019-02-11T11:22:41","date_gmt":"2019-02-11T17:22:41","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=29132"},"modified":"2022-12-08T05:18:40","modified_gmt":"2022-12-08T11:18:40","slug":"how-to-create-a-swap-file-in-linux","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/","title":{"rendered":"How to Create a Swap File in Linux"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div><p><img decoding=\"async\" class=\"alignnone size-full wp-image-29528\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2019\/01\/create-swapfile-linux.jpg\" alt=\"Create a Swap File in Linux\" width=\"742\" height=\"372\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2019\/01\/create-swapfile-linux.jpg 742w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2019\/01\/create-swapfile-linux-150x75.jpg 150w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2019\/01\/create-swapfile-linux-300x150.jpg 300w\" sizes=\"(max-width: 742px) 100vw, 742px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>In this article, we will talk about Swap files, and how to create swap space in Linux using a swap file.<\/p>\n<p><!--more--><\/p>\n<p>But before we begin, we need to clarify what swap actually is. Swap is reserved disk space that is used as a place where the OS can temporarily store data when the physical RAM memory is full or close to full. In other words, swap is reserved virtual memory on the disk. Usually, swap is used to improve and maintain system performance when we are dealing with some resource-heavy tasks.<\/p>\n<p>Whenever the system requires more memory to create new processes, the kernel will move some processes that are inactive to the swap partition so that it can make room for active processes.<br \/>\nPlease note that swap is generally recommended for systems that are using traditional spinning hard drives. If your system is using swap with an SSD or NVMe drive, it may cause issues with hardware degradation over time.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69f4ff73d96d4\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69f4ff73d96d4\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/#1-System-Check-for-Swap-Information\" >1. System Check for Swap Information<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/#2-Create-Swap\" >2. Create Swap<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/#3-Enable-Swap\" >3. Enable Swap<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/#4-Make-the-Swap-File-Permanent\" >4. Make the Swap File Permanent<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/#5-How-to-remove-the-Swap-File\" >5. How to remove the Swap File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"1-System-Check-for-Swap-Information\"><\/span>1. System Check for Swap Information<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Before we create swap space, will check if any swap file or partition has already been set on the server. We are allowed to have more than one swap, but one swap should be more than enough in most cases.<\/p>\n<p>With the following command we can check if there is a swap file or partition already configured on the server:<\/p>\n<pre>sudo swapon --show<\/pre>\n<p>If there is no output, it means that your server does not currently have swap set up.<\/p>\n<p>To make sure that your server is not using swap you can use the <strong>&#8216;free&#8217;<\/strong> command:<\/p>\n<pre>free -h<\/pre>\n<p>The output should be similar to this:<\/p>\n<pre>              total        used        free      shared  buff\/cache   available\r\nMem:           985M        228M        579M        5.5M        177M        618M\r\nSwap:            0B          0B          0B\r\n<\/pre>\n<p>We can see from the output that &#8220;Swap&#8221; row is zero which means that there is no active swap on the server. However, in our example, we will create a swap file that will be located on a partition that already exists.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"2-Create-Swap\"><\/span>2. Create Swap<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Usually, the allocated space for swap is used as a separate partition. Before we create a swap file it is best to check the disk usage:<\/p>\n<pre>df -h<\/pre>\n<p>The output should be similar to this:<\/p>\n<pre>Filesystem      Size  Used Avail Use% Mounted on\r\nudev            463M     0  463M   0% \/dev\r\ntmpfs            99M  3.7M   95M   4% \/run\r\n\/dev\/vda1        19G  2.2G   16G  13% \/\r\ntmpfs           493M     0  493M   0% \/dev\/shm\r\ntmpfs           5.0M     0  5.0M   0% \/run\/lock\r\ntmpfs           493M     0  493M   0% \/sys\/fs\/cgroup\r\ntmpfs            99M     0   99M   0% \/run\/user\/0\r\n<\/pre>\n<p>We can see from the output that on our server we have 16 GB available space (2.2 GB used) which is enough to create a swap file.<\/p>\n<p>Now that we know that we have storage space available, we will create a file called swap_file that will be 2GB in size and will be located in the \/mnt directory. By using the command below we will create the actual swap file:<\/p>\n<pre>sudo fallocate -l 2G \/mnt\/swap_file<\/pre>\n<p>We can also use the dd command in case we do not have\u00a0fallocate installed on the server:<\/p>\n<pre>sudo dd if=\/dev\/zero of=\/mnt\/swap_file bs=1024 count=2097152<\/pre>\n<p>Where bs=1024 means to allocate 1024 bytes at a time for reading and writing count = 2048 means to allocate 1024 bytes 2048 times, creating a 2GB file.<\/p>\n<p>When the swap file is created, we can check if the correct size of the space is being reserved:<\/p>\n<pre>ls -lh \/mnt\/swap_file<\/pre>\n<p>The output should be similar to this:<\/p>\n<pre>-rw-r--r-- 1 root root 2.0G Nov 24 10:32 \/mnt\/swap_file<\/pre>\n<p>From the output result, we can see that the swap file was created with 2GB of storage.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"3-Enable-Swap\"><\/span>3. Enable Swap<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Now that we have an available swap file, we need to use it and turn into actual swap space.<\/p>\n<p>The first step will be to lock the permissions of swap_file so that it can only be read by users with root privileges. We can do this by typing:<\/p>\n<pre>sudo chmod 600 \/mnt\/swap_file<\/pre>\n<p>Now list the file so that we can verify its permissions.<\/p>\n<pre>ls -lh \/mnt\/swap_file<\/pre>\n<p>Output:<\/p>\n<pre>-rw------- 1 root root 2.0G Nov 24 10:33 \/mnt\/swap_file<\/pre>\n<p>From the output above, we can see that only the root user has the read and write flags enabled.<\/p>\n<p>The next step is to mark the file as swap.<\/p>\n<pre>sudo mkswap \/mnt\/swap_file<\/pre>\n<p>Output:<\/p>\n<pre>Setting up swapspace version 1, size = 2 GiB (2147479552 bytes)\r\nno label, UUID=c569dd4f-ffd9-4192-93dd-f6a470025d76<\/pre>\n<p>After we mark the file, we can activate the swap file and allow our server to start using it:<\/p>\n<pre>sudo swapon \/mnt\/swap_file<\/pre>\n<p>We can check if the swap file is available with the following command:<\/p>\n<pre>sudo swapon -s<\/pre>\n<p>Output:<\/p>\n<pre>Filename                                Type            Size    Used    Priority\r\n\/mnt\/swap_file                          file            2097148 0       -2\r\n<\/pre>\n<p>We can again check the output of the &#8216;free&#8217; command to confirm:<\/p>\n<pre>free -h<\/pre>\n<p>Output:<\/p>\n<pre>              total        used        free      shared  buff\/cache   available\r\nMem:           985M        228M         64M        5.5M        691M        608M\r\nSwap:          2.0G          0B        2.0G\r\n<\/pre>\n<p>From the above results, we can see that the swap was successfully set up.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"4-Make-the-Swap-File-Permanent\"><\/span>4. Make the Swap File Permanent<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>With the changes above we created a swap file, but it is temporary and valid only until the next server boot. If we reboot the system, the server will not keep the swap settings that we created. To change this, we need to edit the \/etc\/fstab file and add the swap file in it.<\/p>\n<p>It is a good idea to create a backup of the \/etc\/fstab file before making any changes.<\/p>\n<pre>sudo cp \/etc\/fstab \/etc\/fstab_bak<\/pre>\n<p>Now you can edit the \/etc\/fstab with your preferred text editor (in this case we will use nano)<\/p>\n<pre>sudo nano \/etc\/fstab<\/pre>\n<p>and add the following line to it:<\/p>\n<pre>\/mnt\/swap_file swap swap defaults 0 0<\/pre>\n<p>Save and close the file.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"5-How-to-remove-the-Swap-File\"><\/span>5. How to remove the Swap File<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>In the last part of this article, we will show you how to deactivate and remove the swap file.<\/p>\n<p>We can deactivate the swap file by using this command:<\/p>\n<pre>sudo swapoff -v \/mnt\/swap_file<\/pre>\n<p>Output:<\/p>\n<pre>swapoff \/mnt\/swap_file<\/pre>\n<p>Then edit the \/etc\/fstab file and remove the swap file by removing or commenting the line:<\/p>\n<p>\/mnt\/swap_file swap swap defaults 0 0<\/p>\n<p>In the end, you can delete the actual swap file if desired:<\/p>\n<pre>sudo rm -rf \/mnt\/swap_file<\/pre>\n<p>Using these steps, we completely removed the swap file from our server.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>In this article, we learned how to check if we have swap enabled on our server, how to create a swap file, how to enable swap, how to make the swap file permanent and how to deactivate and remove the swap file from our server.<\/p>\n<p>Swap space can be very useful sometimes, but if your server is running into OOM (out of memory) errors, the best solution is to upgrade your server to a higher hosting plan.<\/p>\n<hr \/>\n<p>Of course, if you are one of our <a href=\"https:\/\/www.rosehosting.com\/nvme-hosting.html\">NVMe hosting<\/a> customers, we can do all of this for you.\u00a0Simply contact our system administrators and they will respond to your request as soon as possible.<\/p>\n<p><strong><span style=\"color: #ff0000;\">PS<\/span>.<\/strong>\u00a0If you liked this post about <strong>how to create a Linux SWAP file in Linux<\/strong>, please share it with your friends on the social networks using the buttons below or simply leave a comment in the comments section. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; In this article, we will talk about Swap files, and how to create swap space in Linux using a &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"How to Create a Swap File in Linux\" class=\"read-more button\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/#more-29132\" aria-label=\"Read more about How to Create a Swap File in Linux\">Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":29528,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[27,1773],"class_list":["post-29132","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-linux","tag-swap","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-33"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.5 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Create a Swap File in Linux | RoseHosting<\/title>\n<meta name=\"description\" content=\"How to Create a Swap File in Linux | RoseHosting\" \/>\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.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Create a Swap File in Linux\" \/>\n<meta property=\"og:description\" content=\"How to Create a Swap File in Linux | RoseHosting\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"RoseHosting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RoseHosting\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/rosehosting.helpdesk\" \/>\n<meta property=\"article:published_time\" content=\"2019-02-11T17:22:41+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-08T11:18:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2019\/01\/create-swapfile-linux.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"742\" \/>\n\t<meta property=\"og:image:height\" content=\"372\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Jeff Wilson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:site\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeff Wilson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-create-a-swap-file-in-linux\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-create-a-swap-file-in-linux\\\/\"},\"author\":{\"name\":\"Jeff Wilson\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ce77a842fa6a9a7f8efa186f2353713\"},\"headline\":\"How to Create a Swap File in Linux\",\"datePublished\":\"2019-02-11T17:22:41+00:00\",\"dateModified\":\"2022-12-08T11:18:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-create-a-swap-file-in-linux\\\/\"},\"wordCount\":1002,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-create-a-swap-file-in-linux\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/01\\\/create-swapfile-linux.jpg\",\"keywords\":[\"Linux\",\"swap\"],\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-create-a-swap-file-in-linux\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-create-a-swap-file-in-linux\\\/\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-create-a-swap-file-in-linux\\\/\",\"name\":\"How to Create a Swap File in Linux | RoseHosting\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-create-a-swap-file-in-linux\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-create-a-swap-file-in-linux\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/01\\\/create-swapfile-linux.jpg\",\"datePublished\":\"2019-02-11T17:22:41+00:00\",\"dateModified\":\"2022-12-08T11:18:40+00:00\",\"description\":\"How to Create a Swap File in Linux | RoseHosting\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-create-a-swap-file-in-linux\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-create-a-swap-file-in-linux\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-create-a-swap-file-in-linux\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/01\\\/create-swapfile-linux.jpg\",\"contentUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/01\\\/create-swapfile-linux.jpg\",\"width\":742,\"height\":372,\"caption\":\"Create a Swap File in Linux\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-create-a-swap-file-in-linux\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Create a Swap File in Linux\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\",\"name\":\"RoseHosting.com\",\"description\":\"Premium Linux Tutorials Since 2001\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\",\"name\":\"RoseHosting\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/android-chrome-192x192-1.png\",\"contentUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/android-chrome-192x192-1.png\",\"width\":192,\"height\":192,\"caption\":\"RoseHosting\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/RoseHosting\",\"https:\\\/\\\/x.com\\\/rosehosting\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/rosehosting\\\/\"],\"description\":\"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.\",\"email\":\"info@rosehosting.com\",\"telephone\":\"(314) 275-0414\",\"legalName\":\"Rose Web Services LLC\",\"foundingDate\":\"2001-04-02\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"11\",\"maxValue\":\"50\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ce77a842fa6a9a7f8efa186f2353713\",\"name\":\"Jeff Wilson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"caption\":\"Jeff Wilson\"},\"description\":\"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.\",\"sameAs\":[\"https:\\\/\\\/www.rosehosting.com\",\"https:\\\/\\\/www.facebook.com\\\/rosehosting.helpdesk\"],\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/author\\\/jwilson\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Create a Swap File in Linux | RoseHosting","description":"How to Create a Swap File in Linux | RoseHosting","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.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/","og_locale":"en_US","og_type":"article","og_title":"How to Create a Swap File in Linux","og_description":"How to Create a Swap File in Linux | RoseHosting","og_url":"https:\/\/www.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/","og_site_name":"RoseHosting","article_publisher":"https:\/\/www.facebook.com\/RoseHosting","article_author":"https:\/\/www.facebook.com\/rosehosting.helpdesk","article_published_time":"2019-02-11T17:22:41+00:00","article_modified_time":"2022-12-08T11:18:40+00:00","og_image":[{"width":742,"height":372,"url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2019\/01\/create-swapfile-linux.jpg","type":"image\/jpeg"}],"author":"Jeff Wilson","twitter_card":"summary_large_image","twitter_creator":"@rosehosting","twitter_site":"@rosehosting","twitter_misc":{"Written by":"Jeff Wilson","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/#article","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/"},"author":{"name":"Jeff Wilson","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713"},"headline":"How to Create a Swap File in Linux","datePublished":"2019-02-11T17:22:41+00:00","dateModified":"2022-12-08T11:18:40+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/"},"wordCount":1002,"commentCount":0,"publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2019\/01\/create-swapfile-linux.jpg","keywords":["Linux","swap"],"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/","url":"https:\/\/www.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/","name":"How to Create a Swap File in Linux | RoseHosting","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/#primaryimage"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2019\/01\/create-swapfile-linux.jpg","datePublished":"2019-02-11T17:22:41+00:00","dateModified":"2022-12-08T11:18:40+00:00","description":"How to Create a Swap File in Linux | RoseHosting","breadcrumb":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/#primaryimage","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2019\/01\/create-swapfile-linux.jpg","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2019\/01\/create-swapfile-linux.jpg","width":742,"height":372,"caption":"Create a Swap File in Linux"},{"@type":"BreadcrumbList","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-create-a-swap-file-in-linux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rosehosting.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Create a Swap File in Linux"}]},{"@type":"WebSite","@id":"https:\/\/www.rosehosting.com\/blog\/#website","url":"https:\/\/www.rosehosting.com\/blog\/","name":"RoseHosting.com","description":"Premium Linux Tutorials Since 2001","publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.rosehosting.com\/blog\/#organization","name":"RoseHosting","url":"https:\/\/www.rosehosting.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","width":192,"height":192,"caption":"RoseHosting"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RoseHosting","https:\/\/x.com\/rosehosting","https:\/\/www.linkedin.com\/in\/rosehosting\/"],"description":"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.","email":"info@rosehosting.com","telephone":"(314) 275-0414","legalName":"Rose Web Services LLC","foundingDate":"2001-04-02","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"11","maxValue":"50"}},{"@type":"Person","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713","name":"Jeff Wilson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","caption":"Jeff Wilson"},"description":"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.","sameAs":["https:\/\/www.rosehosting.com","https:\/\/www.facebook.com\/rosehosting.helpdesk"],"url":"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/"}]}},"_links":{"self":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/29132","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/comments?post=29132"}],"version-history":[{"count":2,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/29132\/revisions"}],"predecessor-version":[{"id":43807,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/29132\/revisions\/43807"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media\/29528"}],"wp:attachment":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media?parent=29132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/categories?post=29132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/tags?post=29132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}