<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.hermann-uwe.de" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>Uwe Hermann - Resizing a dm-crypt / LVM / ext3 partition - Comments</title>
 <link>http://www.hermann-uwe.de/blog/resizing-a-dm-crypt-lvm-ext3-partition</link>
 <description>Comments for &quot;Resizing a dm-crypt / LVM / ext3 partition&quot;</description>
 <language>en</language>
<item>
 <title>Thanks (and an Ubuntu live-cd note)</title>
 <link>http://www.hermann-uwe.de/blog/resizing-a-dm-crypt-lvm-ext3-partition#comment-62193</link>
 <description>&lt;p&gt;Great post, your method worked like a charm for me. Just a tip for anyone booting from a Ubuntu live cd: run &lt;code&gt;sudo modprobe dm-crypt&lt;/code&gt; before trying to open the luks partition with &lt;code&gt;cryptsetup&lt;/code&gt;, or you&#039;ll get cryptic errors about &lt;em&gt;&quot;no keyfile found that matches this passphrase&quot;&lt;/em&gt;.&lt;/p&gt;
</description>
 <pubDate>Thu, 18 Dec 2008 04:35:42 +0100</pubDate>
 <dc:creator>Anonymous</dc:creator>
 <guid isPermaLink="false">comment 62193 at http://www.hermann-uwe.de</guid>
</item>
<item>
 <title>Why don&#039;t u just add a new</title>
 <link>http://www.hermann-uwe.de/blog/resizing-a-dm-crypt-lvm-ext3-partition#comment-60400</link>
 <description>&lt;p&gt;Why don&#039;t u just add a new Physical Volume to your Volume Group and then resize target Logical Volume?&lt;/p&gt;
</description>
 <pubDate>Fri, 07 Nov 2008 07:42:10 +0100</pubDate>
 <dc:creator>Kir</dc:creator>
 <guid isPermaLink="false">comment 60400 at http://www.hermann-uwe.de</guid>
</item>
<item>
 <title>resize2fs</title>
 <link>http://www.hermann-uwe.de/blog/resizing-a-dm-crypt-lvm-ext3-partition#comment-52737</link>
 <description>&lt;p&gt;Yes, resize2fs should work just fine for ext2, too. But of course the usual disclaimer applies, make sure you have recent backups!&lt;/p&gt;
&lt;p&gt;Uwe.&lt;/p&gt;
</description>
 <pubDate>Wed, 23 Apr 2008 18:17:39 +0200</pubDate>
 <dc:creator>Uwe Hermann</dc:creator>
 <guid isPermaLink="false">comment 52737 at http://www.hermann-uwe.de</guid>
</item>
<item>
 <title>ext2 ..?</title>
 <link>http://www.hermann-uwe.de/blog/resizing-a-dm-crypt-lvm-ext3-partition#comment-52736</link>
 <description>&lt;p&gt;nice article...but can this be applied to ext2...?&lt;br /&gt;
will there be any change in commands...? coz mine is ext2 filesystem and i need to resize it...&lt;/p&gt;
</description>
 <pubDate>Wed, 23 Apr 2008 17:31:00 +0200</pubDate>
 <dc:creator>Rostyslav</dc:creator>
 <guid isPermaLink="false">comment 52736 at http://www.hermann-uwe.de</guid>
</item>
<item>
 <title>Do not know how to resize extra disk space after cloning disk</title>
 <link>http://www.hermann-uwe.de/blog/resizing-a-dm-crypt-lvm-ext3-partition#comment-52660</link>
 <description>&lt;p&gt;Hi, I google around and lucky I found your blog regarding resizing. I have trouble resizing after similar issue like you. But the difference is I&#039;m newbie with Linux, so hope you can help me. Appreciate if you can help. If possible let me knowin step by steps. I&#039;m almost give up. Here is my problem:&lt;/p&gt;
&lt;p&gt;I&#039;ve a 160Gb HD running with Centos5. I have just clone the 160Gb to 500Gb HD with G4U. After disk cloning, I have about 317Gb unused space. Because G4U copy bit by bits, system will show it is 80Gb even physically it is 500Gb. Basically, I like to merge the 317GB unused space to sda2 or at least make it useable.  Understand from Gparted, that it does not support LVM, but I used it to show my status as below:&lt;/p&gt;
&lt;p&gt;When I run Gparted for 500GB HD, it is showing:&lt;br /&gt;
/dev/sda1     ext3      /boot    size:102MB      used: 20MB     Unused: 82MB&lt;br /&gt;
/dev/sda2     unknown           size: 148.95GB       used: ---      Unused: ----     Flag: lvm&lt;br /&gt;
unallocated     unallocated      size: 317GB         used: ---     Unused: ----&lt;/p&gt;
&lt;p&gt;On top right-hand corner, it&#039;s showing:&lt;br /&gt;
/dev/sda&lt;br /&gt;
/dev/mapper/VolGroup00-LogVol00  (148Gb)&lt;br /&gt;
/dev/mapper/VolGroup00-LogVol01  (988Mb)&lt;/p&gt;
&lt;p&gt;If I select /dev/mapper/VolGroup00-LogVol00 (148Gb), it will display:&lt;br /&gt;
/dev/mapper/VolGroup00-LogVol00    ext3      Size: 148GB    Used:8.6GB     Unused: 139.4GB&lt;/p&gt;
&lt;p&gt;If I select /dev/mapper/VolGroup00-LogVol01 (998GB), it will display:&lt;br /&gt;
/dev/mapper/VolGroup00-LogVol01     linux-swap   Label:ID_FS_USAGE=other   size: 992MB&lt;/p&gt;
</description>
 <pubDate>Mon, 21 Apr 2008 17:41:53 +0200</pubDate>
 <dc:creator>dstme</dc:creator>
 <guid isPermaLink="false">comment 52660 at http://www.hermann-uwe.de</guid>
</item>
<item>
 <title>fdisk</title>
 <link>http://www.hermann-uwe.de/blog/resizing-a-dm-crypt-lvm-ext3-partition#comment-52192</link>
 <description>&lt;p&gt;Sure, if you know what you&#039;re doing and you are only messing with the partition table but not with the data itself, there&#039;s no problem. I&#039;m just stressing the point that you shouldn&#039;t blindly type stuff at an fdisk prompt unless you know what you&#039;re doing ;-) I don&#039;t want to be responsible for other people losing their data.&lt;/p&gt;
&lt;p&gt;Uwe.&lt;/p&gt;
</description>
 <pubDate>Wed, 16 Apr 2008 00:49:06 +0200</pubDate>
 <dc:creator>Uwe Hermann</dc:creator>
 <guid isPermaLink="false">comment 52192 at http://www.hermann-uwe.de</guid>
</item>
<item>
 <title>Interesting</title>
 <link>http://www.hermann-uwe.de/blog/resizing-a-dm-crypt-lvm-ext3-partition#comment-52170</link>
 <description>&lt;p&gt;Really interesting information. I never had to resize an LUKS-encrypted volume, but it can happen, so I hope I will remember to come here when i&#039;ll need it :)&lt;/p&gt;
</description>
 <pubDate>Tue, 15 Apr 2008 09:49:10 +0200</pubDate>
 <dc:creator>er:c</dc:creator>
 <guid isPermaLink="false">comment 52170 at http://www.hermann-uwe.de</guid>
</item>
<item>
 <title>fdisk</title>
 <link>http://www.hermann-uwe.de/blog/resizing-a-dm-crypt-lvm-ext3-partition#comment-52158</link>
 <description>&lt;p&gt;Changing the partition size is a lot less scary than you make it out to be.&lt;br /&gt;
The partition table is a few bytes at the beginning of the harddisk. Changing it is about as scary as editing my ~/.profile file.&lt;br /&gt;
If you want to be extra super careful, make a dump of the partition table before:&lt;/p&gt;
&lt;p&gt;sfdisk -d /dev/hda &amp;gt; hda.partitionlist&lt;/p&gt;
&lt;p&gt;This can then be reimported in case something Bad happend:&lt;/p&gt;
&lt;p&gt;sfdisk /dev/hda &amp;lt; hda.partitionlist&lt;/p&gt;
</description>
 <pubDate>Tue, 15 Apr 2008 08:00:18 +0200</pubDate>
 <dc:creator>blindcoder</dc:creator>
 <guid isPermaLink="false">comment 52158 at http://www.hermann-uwe.de</guid>
</item>
<item>
 <title>Resizing a dm-crypt / LVM / ext3 partition</title>
 <link>http://www.hermann-uwe.de/blog/resizing-a-dm-crypt-lvm-ext3-partition</link>
 <description>&lt;p&gt;I&#039;ve bought a new hard drive for my laptop recently, because I finally got fed up with my constantly-full disk. Having to browse around in $HOME looking for stuff which can be safely deleted just because I want to run &lt;code&gt;fetchmail&lt;/code&gt; (and that would fill up my disk) just sucks. So, after getting a cheapo 160 GB 2.5&quot; disk (the old one was 80 GB), I had to move all my data to the new disk.&lt;/p&gt;
&lt;p&gt;As I didn&#039;t want to re-install from scratch I started with &lt;code&gt;dd&lt;/code&gt;&#039;ing the whole disk over to the new one (using a live CD and an external USB hard-drive enclosure). This took pretty long, but went fine otherwise.&lt;/p&gt;
&lt;p&gt;The new disk then contained all my partitions (hda1-hda3) and also GRUB in the MBR etc., as expected, but was still only 80 GB in size, of course. So the first step is to enlarge the hda3 partition, which is a dm-crypt volume that contains various LVM logical volumes (for /home, /usr, /var, swap, etc.), each of them using the ext3 filesystem (except for the swap volume, of course).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;0. Perform backups, boot from a live CD&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong style=&quot;color: red&quot;&gt;Important:&lt;/strong&gt; If you plan to perform any of these steps, make sure you have recent backups! I take no responsibility for any data loss you might experience. You have been warned!&lt;/p&gt;
&lt;p&gt;First off, you should boot from a live CD which has all the tools you&#039;ll need, including cryptsetup, LVM tools, resize2fs, etc. You can use the nice &lt;a href=&quot;http://grml.org/&quot;&gt;grml&lt;/a&gt; live CD for instance.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1. Resize partition&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This sounds scary (and it is!), but the way I enlarged the encrypted &lt;strong&gt;hda3&lt;/strong&gt; partition was by first &lt;strong&gt;deleting it&lt;/strong&gt; via &lt;code&gt;fdisk&lt;/code&gt;. First, issue the &quot;p&quot; command in fdisk, write down the exact start cylinder of hda3. Then delete hda3. Now create a new hda3 partition &lt;strong&gt;which starts at exactly the same cylinder as the old hda3&lt;/strong&gt; but is larger, i.e. in my case it has ca. 80 GB additional space.&lt;/p&gt;
&lt;p&gt;Your data will still be there if you don&#039;t screw up, and the partition is bigger now. Using something like gparted will likely &lt;strong&gt;not&lt;/strong&gt; work as expected, as the partition is encrypted!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2. Resize dm-crypt volume&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Nothing to be done, it seems dm-crypt automatically adapts and notices that the partition is bigger. Just &quot;open&quot; the encrypted volume using &lt;code&gt;cryptsetup&lt;/code&gt; now:&lt;/p&gt;
&lt;pre&gt;
  $ cryptsetup luksOpen /dev/hda3 foo
&lt;/pre&gt;&lt;p&gt;
&lt;strong&gt;3. Resize LVM physical volume&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Next step is to tell LVM about the new space. We first resize the LVM physical volume on the &lt;code&gt;foo&lt;/code&gt; &quot;partition&quot; to use up all newly-available space.&lt;/p&gt;
&lt;pre&gt;
  $ pvresize /dev/mapper/foo
&lt;/pre&gt;&lt;p&gt;
&lt;strong&gt;4. Resize LVM logical volume&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Now we can pump the new space into any of the logical volumes (or into multiple ones). I only increased one logical volume, my /home:&lt;/p&gt;
&lt;pre&gt;
  $ lvresize -L +74 GB /dev/vg-whole/lv-home
&lt;/pre&gt;&lt;p&gt;
&lt;strong&gt;5. Resize ext3 filesystem&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The final step is to resize the ext3 filesystem on the &lt;code&gt;lv-home&lt;/code&gt; logical volume (after running the obligatory &lt;strong&gt;fsck -n&lt;/strong&gt;). I first used &lt;strong&gt;ext2resize&lt;/strong&gt;, but that failed horribly:&lt;/p&gt;
&lt;pre&gt;
  $ fsck -n /dev/vg-whole/lv-home
  $ ext2resize /dev/vg-whole/lv-home
  error: Invalid argument: seeking to 3258921205760
&lt;/pre&gt;&lt;p&gt;
This seems to be a known bug, ext2resize apparently cannot handle large disks or something, and as I found out a few minutes later it&#039;s pretty much &lt;a href=&quot;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=400797&quot;&gt;deprecated&lt;/a&gt; anyway. The better solution is to use &lt;strong&gt;resize2fs&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;
  $ fsck -n /dev/vg-whole/lv-home
  $ resize2fs /dev/vg-whole/lv-home
&lt;/pre&gt;&lt;p&gt;
That&#039;s it. We can now reboot the system from disk and enjoy ca. 80 GB of additional hard drive space. Yay!&lt;/p&gt;
</description>
 <comments>http://www.hermann-uwe.de/blog/resizing-a-dm-crypt-lvm-ext3-partition#comments</comments>
 <category domain="http://www.hermann-uwe.de/taxonomy/term/1209">crypto</category>
 <category domain="http://www.hermann-uwe.de/taxonomy/term/1298">dm-crypt</category>
 <category domain="http://www.hermann-uwe.de/taxonomy/term/1868">ext2resize</category>
 <category domain="http://www.hermann-uwe.de/taxonomy/term/527">ext3</category>
 <category domain="http://www.hermann-uwe.de/taxonomy/term/1866">filesystem</category>
 <category domain="http://www.hermann-uwe.de/taxonomy/term/335">kernel</category>
 <category domain="http://www.hermann-uwe.de/taxonomy/term/60">linux</category>
 <category domain="http://www.hermann-uwe.de/taxonomy/term/1571">lvm</category>
 <category domain="http://www.hermann-uwe.de/taxonomy/term/1867">resize2fs</category>
 <category domain="http://www.hermann-uwe.de/taxonomy/term/38">security</category>
 <pubDate>Mon, 14 Apr 2008 17:32:18 +0200</pubDate>
 <dc:creator>Uwe Hermann</dc:creator>
 <guid isPermaLink="false">1309 at http://www.hermann-uwe.de</guid>
</item>
</channel>
</rss>
