<?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>Guru dell&#039;Eccelso Picco &#187; partition resize</title>
	<atom:link href="http://blog.gurudelleccelsopicco.org/tag/partition-resize/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.gurudelleccelsopicco.org</link>
	<description>Things should be as simple as possible, but not simpler. 		-- Albert Einstein</description>
	<lastBuildDate>Sun, 05 Feb 2012 20:44:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Online LUN expansion and partition resizing without reboot under Linux</title>
		<link>http://blog.gurudelleccelsopicco.org/2009/09/online-lun-expansion-and-partition-resizing-without-reboot-under-linux/</link>
		<comments>http://blog.gurudelleccelsopicco.org/2009/09/online-lun-expansion-and-partition-resizing-without-reboot-under-linux/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 15:55:43 +0000</pubDate>
		<dc:creator>Luca Maranzano</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[SAN]]></category>
		<category><![CDATA[fdisk]]></category>
		<category><![CDATA[file system resize]]></category>
		<category><![CDATA[partition resize]]></category>
		<category><![CDATA[partprobe]]></category>
		<category><![CDATA[resize2fs]]></category>
		<category><![CDATA[scsi rescan]]></category>

		<guid isPermaLink="false">http://blog.gurudelleccelsopicco.org/?p=120</guid>
		<description><![CDATA[<p>If you are in the need of expanding the LUN where your Linux is installed without rebooting the server, then may be that here you can find the right answer. Your Linux must be sufficiently recent to support features like LVM version 2, ext3 on-line resizing and so on.</p>
<p>My setup in tihs test is the [...]]]></description>
			<content:encoded><![CDATA[<p>If you are in the need of expanding the LUN where your Linux is installed without rebooting the server, then may be that here you can find the right answer. Your Linux must be sufficiently recent to support features like LVM version 2, ext3 on-line resizing and so on.</p>
<p>My setup in tihs test is the following:</p>
<p>A Linux RedHat 5.3 64 bit Virtual Machine with a single 300 GB LUN /dev/sda in Raw Device Mapping mode (Physical Compatibility mode) under VMware 3.5 and a Compellent SAN. Inside the single disk there is one Volume Group (vg0) with serveral Logical Volumes.</p>
<p>The SAN guys expanded on-line the LUN from 300 to 500 GB (a 30&#8243; operation <img src='http://blog.gurudelleccelsopicco.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ).</p>
<p>To force the rescan of partition to get the kernel aware of the new size (supposing your LUN is /dev/sda):</p>
<p><code># echo 1 &gt; /sys/block/sda/device/rescan</code></p>
<p>and then in dmesg you&#8217;ll see:</p>
<p><code>SCSI device sda: 1048576000 512-byte hdwr sectors (536871 MB)<br />
sda: Write Protect is off<br />
sda: Mode Sense: 8f 00 00 08<br />
SCSI device sda: drive cache: write through<br />
sda: detected capacity change from 322122547200 to 536870912000</code></p>
<p>Now you have two choices at this point: expand the partition containing the current volume group or create a new partition and extend the current volume group. I sincerely prefer the latter, since resizing the partition with fdisk is a risky operation IMVHO.</p>
<p>Use fdisk to create a new partition of type LVM (0x8e) in the free space. But at this point you may have trouble in the kernel re-reading the partition table:</p>
<p><code># sfdisk -R /dev/sda<br />
BLKRRPART: Device or resource busy</code></p>
<p>So to inform the OS of the partition table changes use <strong>partprobe</strong>(8) command which comes with the parted packages.</p>
<p>Verify in /proc/partitions that the kernel has updated the partition table.</p>
<p>Now use <strong>pvcreate /dev/sda3</strong>, then <strong>vgextend vg0 /dev/sda3</strong> and you are done! Verify with <strong>vgdisplay</strong> that the Free PE are consistent.</p>
<p>To make some more stress test I made the following:</p>
<p>While running this command on a newly created LVM partition /dev/vg0/TRASHME mounted on /TRASH:</p>
<p><code># dd if=/dev/zero of=TTTT bs=1024k count=30000<br />
..... dd is running.... </code></p>
<p>I tried an online resizing of the Logical Volume and the ext3 partition inside it:</p>
<p><code># lvextend -L+10G /dev/vg0/TRASHME<br />
Extending logical volume TRASHME to 40.00 GB<br />
Logical volume TRASHME successfully resized<br />
# resize2fs /dev/vg0/TRASHME<br />
resize2fs 1.39 (29-May-2006)<br />
Filesystem at /dev/vg0/TRASHME is mounted on /TRASH; on-line resizing required<br />
Performing an on-line resize of /dev/vg0/TRASHME to 10485760 (4k) blocks.<br />
The filesystem on /dev/vg0/TRASHME is now 10485760 blocks long.</code><br />
in the mean time dd finished his work:<br />
<code>30000+0 records in<br />
30000+0 records out<br />
31457280000 bytes (31 GB) copied, 175.612 seconds, 179 MB/s</code></p>
<p>Great! Remember to always backup your data before doing operations like this! YMMV.</p>
<p>((enjoy))</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gurudelleccelsopicco.org/2009/09/online-lun-expansion-and-partition-resizing-without-reboot-under-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

