<?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 LVM - soban</title>
	<atom:link href="https://soban.pl/category/lvm-en/feed/" rel="self" type="application/rss+xml" />
	<link>https://soban.pl/category/lvm-en/</link>
	<description>IT, Linux, Servers, Security</description>
	<lastBuildDate>Wed, 13 Nov 2024 19:59:13 +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>Expanding Storage Space in Linux: Step-by-Step Guide using LVM and fdisk</title>
		<link>https://soban.pl/expanding-storage-space-in-linux-step-by-step-guide-using-lvm-and-fdisk/</link>
		
		<dc:creator><![CDATA[soban]]></dc:creator>
		<pubDate>Wed, 13 Nov 2024 19:54:20 +0000</pubDate>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[LVM]]></category>
		<category><![CDATA[Linux]]></category>
		<guid isPermaLink="false">https://soban.pl/?p=529</guid>

					<description><![CDATA[<p>Expanding disk space in Linux virtual machines is a key aspect of server system management. In this article, we show how to effectively increase disk space using LVM and fdisk tools, based on real system data. Preliminary Preparations Before making changes to partitions and volumes, it is important to check the current state of the [&#8230;]</p>
<p>Artykuł <a href="https://soban.pl/expanding-storage-space-in-linux-step-by-step-guide-using-lvm-and-fdisk/">Expanding Storage Space in Linux: Step-by-Step Guide using LVM and fdisk</a> pochodzi z serwisu <a href="https://soban.pl">soban</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="558" height="562" src="https://soban.pl/wp-content/uploads/2024/11/image-1.png" alt="" class="wp-image-530" srcset="https://soban.pl/wp-content/uploads/2024/11/image-1.png 558w, https://soban.pl/wp-content/uploads/2024/11/image-1-298x300.png 298w, https://soban.pl/wp-content/uploads/2024/11/image-1-150x150.png 150w" sizes="(max-width: 558px) 100vw, 558px" /></figure>

<!-- Introduction -->
<p>Expanding disk space in Linux virtual machines is a key aspect of server system management. In this article, we show how to effectively increase disk space using LVM and fdisk tools, based on real system data.</p>

<!-- Section 1: Preliminary Preparations -->
<h2>Preliminary Preparations</h2>
<p>Before making changes to partitions and volumes, it is important to check the current state of the disks in the system. We will use the <code>lsblk</code> command to identify available disks and partitions.</p>


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


<!-- Example lsblk output -->
<p>Here is an example of the <code>lsblk</code> command output on a machine:</p>
<pre class="urvanov-syntax-highlighter-plain-tag">NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0                       7:0    0 55.7M  1 loop /snap/core18/2829
sda                         8:0    0   42G  0 disk
├─sda1                      8:1    0  512M  0 part /boot/efi
├─sda2                      8:2    0    1G  0 part /boot
└─sda3                      8:3    0 40.5G  0 part
  └─ubuntu--vg-ubuntu--lv 253:0    0 78.5G  0 lvm  /
sdb                         8:16   0  350G  0 disk
└─sdb1                      8:17   0   60G  0 part
  └─ubuntu--vg-ubuntu--lv 253:0    0 78.5G  0 lvm  /
sr0                        11:0    1 1024M  0 rom</pre>
<p><!-- Section 2: Creating Snapshots --></p>
<h2>Creating Snapshots</h2>
<p>Before making changes to disk configurations, it is advisable to create a snapshot of the LVM volumes to ensure data can be restored in case of unexpected issues.</p>


<div class="wp-block-urvanov-syntax-highlighter-code-block"><pre class="urvanov-syntax-highlighter-plain-tag">lvcreate -L 20G -s -n my_snapshot /dev/ubuntu-vg/ubuntu-lv</pre></div>


<p><!-- Section 3: Modifying Partitions --></p>
<h2>Modifying Partitions</h2>
<p>Next, we proceed to modify the partitions using <code>fdisk</code>. We remove the existing partition and then create a new one that utilizes the entire available space on disk <code>sdb</code>.</p>


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


<p><!-- Section 4: Saving Changes --></p>
<h2>Saving Changes</h2>
<p>After properly configuring the partitions, we use the <code>w</code> command in <code>fdisk</code> to save the changes and update the partition table.</p>


<div class="wp-block-urvanov-syntax-highlighter-code-block"><pre class="urvanov-syntax-highlighter-plain-tag">Command (m for help): w</pre></div>


<p><!-- Section 5: Executing pvscan --></p>
<h2>Executing pvscan</h2>
<p>After modifying the partitions, we execute the <code>pvscan</code> command so the system can update information about available physical volumes.</p>


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


<p><!-- Section 6: Configuring LVM --></p>
<h2>Configuring LVM</h2>
<p>After saving changes to the partition table, we need to update the LVM configuration to include the new disk space. We use the <code>lvextend</code> command with automatic file system resizing.</p>


<div class="wp-block-urvanov-syntax-highlighter-code-block"><pre class="urvanov-syntax-highlighter-plain-tag">lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv -r</pre></div>


<p><!-- Summary --></p>
<h2>Summary</h2>
<p>Expanding disk space on a Linux virtual machine enhances performance and the availability of storage space. Thanks to the steps described, managing disk space in systems using LVM becomes simpler and more efficient.</p><p>Artykuł <a href="https://soban.pl/expanding-storage-space-in-linux-step-by-step-guide-using-lvm-and-fdisk/">Expanding Storage Space in Linux: Step-by-Step Guide using LVM and fdisk</a> pochodzi z serwisu <a href="https://soban.pl">soban</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
