<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Archiwa SWAP - soban</title>
	<atom:link href="https://soban.pl/category/swap/feed/" rel="self" type="application/rss+xml" />
	<link>https://soban.pl/category/swap/</link>
	<description>IT, Linux, Servers, Security</description>
	<lastBuildDate>Thu, 18 Apr 2024 10:55:30 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>
	<item>
		<title>Extending SWAP space on Proxmox using lvreduce</title>
		<link>https://soban.pl/extending-swap-space-on-proxmox-using-lvreduce/</link>
		
		<dc:creator><![CDATA[soban]]></dc:creator>
		<pubDate>Thu, 18 Apr 2024 10:55:30 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Proxmox]]></category>
		<category><![CDATA[SWAP]]></category>
		<guid isPermaLink="false">https://soban.pl/?p=470</guid>

					<description><![CDATA[<p>Introduction Managing SWAP memory is a key element in administering Linux operating systems, especially in virtualization environments like Proxmox. SWAP acts as &#8220;virtual memory&#8221; that can be used when the system&#8217;s physical RAM is full. In this article, we will show how to increase SWAP space on a Proxmox server, using the lvresize tool to [&#8230;]</p>
<p>Artykuł <a href="https://soban.pl/extending-swap-space-on-proxmox-using-lvreduce/">Extending SWAP space on Proxmox using lvreduce</a> pochodzi z serwisu <a href="https://soban.pl">soban</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-full is-resized"><img fetchpriority="high" decoding="async" width="844" height="846" src="https://soban.pl/wp-content/uploads/2024/04/swap.png" alt="" class="wp-image-467" style="width:427px;height:auto" srcset="https://soban.pl/wp-content/uploads/2024/04/swap.png 844w, https://soban.pl/wp-content/uploads/2024/04/swap-300x300.png 300w, https://soban.pl/wp-content/uploads/2024/04/swap-150x150.png 150w, https://soban.pl/wp-content/uploads/2024/04/swap-768x770.png 768w" sizes="(max-width: 844px) 100vw, 844px" /></figure>



<p><strong>Introduction</strong></p>



<p>Managing SWAP memory is a key element in administering Linux operating systems, especially in virtualization environments like Proxmox. SWAP acts as &#8220;virtual memory&#8221; that can be used when the system&#8217;s physical RAM is full. In this article, we will show how to increase SWAP space on a Proxmox server, using the lvresize tool to free up disk space that can then be allocated to SWAP.</p>



<h3 class="wp-block-heading">Problem Overview</h3>



<p>A user wants to increase SWAP space from 8 GB to 16 GB, but encounters the problem of lacking available space in the LVM volume group, which is required to increase SWAP.</p>



<h3 class="wp-block-heading">Step 1: Checking Available Space</h3>



<div class="wp-block-urvanov-syntax-highlighter-code-block"><pre class="urvanov-syntax-highlighter-plain-tag">vgs</pre></div>



<p>The command <code>vgs</code> displays the volume groups along with their sizes and available space.</p>



<h3 class="wp-block-heading">Step 2: Reducing the Volume</h3>



<p>Suppose there is a <code>root</code> volume of 457.26 GB, which can be reduced to free up an additional 8 GB for SWAP. Before reducing the volume, it is necessary to reduce the file system on this volume.</p>



<div class="wp-block-urvanov-syntax-highlighter-code-block"><pre class="urvanov-syntax-highlighter-plain-tag">resize2fs /dev/pve/root 449.26G</pre></div>



<p>However, in the case of the XFS file system, reduction must occur offline or from a live CD.</p>



<h3 class="wp-block-heading">Step 3: Using lvreduce</h3>



<div class="wp-block-urvanov-syntax-highlighter-code-block"><pre class="urvanov-syntax-highlighter-plain-tag">lvreduce -L -8G /dev/pve/root</pre></div>



<p>This command reduces the <code>root</code> volume by 8 GB, which is confirmed by a message about the volume size change.</p>



<h3 class="wp-block-heading">Step 4: Deactivating SWAP</h3>



<div class="wp-block-urvanov-syntax-highlighter-code-block"><pre class="urvanov-syntax-highlighter-plain-tag">swapoff -a</pre></div>



<p>Before starting changes in SWAP size, SWAP must first be turned off using the above command.</p>



<h3 class="wp-block-heading">Step 5: Expanding SWAP</h3>



<div class="wp-block-urvanov-syntax-highlighter-code-block"><pre class="urvanov-syntax-highlighter-plain-tag">lvresize -L +8G /dev/pve/swap
mkswap /dev/pve/swap
swapon /dev/pve/swap</pre></div>



<p>The above commands first increase the SWAP space, then format it and reactivate it.</p>



<div class="wp-block-urvanov-syntax-highlighter-code-block"><pre class="urvanov-syntax-highlighter-plain-tag">swapon --show</pre></div>



<p>Finally, we verify the active SWAP areas using the above command to ensure everything is configured correctly.</p>



<p>This process shows how you can flexibly manage disk space on Proxmox servers, adjusting the size of SWAP depending on needs. Using <code>lvreduce</code> requires caution, as any operation on partitions and volumes carries the risk of data loss, therefore it is always recommended to make backups before proceeding with changes.</p>
<p>Artykuł <a href="https://soban.pl/extending-swap-space-on-proxmox-using-lvreduce/">Extending SWAP space on Proxmox using lvreduce</a> pochodzi z serwisu <a href="https://soban.pl">soban</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
