<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>alexalmazan.com: EXT3 online resize</title>
    <link>http://alexalmazan.com/articles/2008/06/03/ext3-online-resize</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>atypical typo tech rhelish</description>
    <item>
      <title>EXT3 online resize</title>
      <description>&lt;p&gt;Introduction of an additional drive into a &lt;span class="caps"&gt;RAID&lt;/span&gt; array to expand capacity requires additional steps in the OS to expand the partition without data  loss.&lt;/p&gt;


	&lt;p&gt;First, fdisk the device and delete the &amp;#8220;EXTENDED&amp;#8221; partition that you are looking to resize, in this instance partition 4.&lt;/p&gt;


&lt;pre&gt;
[root@app1 ~]# fdisk /dev/sda

The number of cylinders for this disk is set to 53309.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sda: 438.4 GB, 438489317376 bytes
255 heads, 63 sectors/track, 53309 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14         274     2096482+  83  Linux
/dev/sda3             275         405     1052257+  82  Linux swap
/dev/sda4             406       35539   282213855    5  Extended
/dev/sda5             406       35539   282213823+  83  Linux
Command (m for help): d
Partition number (1-5): 4

Command (m for help): p

Disk /dev/sda: 438.4 GB, 438489317376 bytes
255 heads, 63 sectors/track, 53309 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14         274     2096482+  83  Linux
/dev/sda3             275         405     1052257+  82  Linux swap
&lt;/pre&gt;
Once this has been removed the partition should be re-created as extended, then a primary partition introduced
&lt;pre&gt;
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
e
Selected partition 4
First cylinder (406-53309, default 406): 
Using default value 406
Last cylinder or +size or +sizeM or +sizeK (406-53309, default 53309): 
Using default value 53309

Command (m for help): p

Disk /dev/sda: 438.4 GB, 438489317376 bytes
255 heads, 63 sectors/track, 53309 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14         274     2096482+  83  Linux
/dev/sda3             275         405     1052257+  82  Linux swap
/dev/sda4             406       53309   424951380    5  Extended
&lt;/pre&gt;
Now introduce a primary partition on the extended

&lt;strong&gt;&lt;span style="color:red;"&gt;&lt;span class="caps"&gt;NOTICE&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;- The cylinder in use of the removed partition should be noted as the subsequent introduction of the new partition will require this detail in order to preserve the data
&lt;pre&gt;
Command (m for help): n
First cylinder (406-53309, default 406): 
Using default value 406
Last cylinder or +size or +sizeM or +sizeK (406-53309, default 53309): 
Using default value 53309

Command (m for help): p

Disk /dev/sda: 438.4 GB, 438489317376 bytes
255 heads, 63 sectors/track, 53309 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14         274     2096482+  83  Linux
/dev/sda3             275         405     1052257+  82  Linux swap
/dev/sda4             406       53309   424951380    5  Extended
/dev/sda5             406       53309   424951348+  83  Linux
&lt;/pre&gt;
write the changes and exit
&lt;pre&gt;
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

&lt;/pre&gt;
A reboot of the system is required.

The final step is &amp;#8216;ext2online&amp;#8217; of &amp;#8217;/&amp;#8217;
&lt;pre&gt;
[root@app1 ~]# ext2online /
ext2online v1.1.18 - 2001/03/18 for EXT2FS 0.5b
&lt;/pre&gt;

Partition expanded from this:
&lt;pre&gt;
[root@app1 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda5             265G  256G  9.9G  97% /
/dev/sda1              99M   12M   82M  13% /boot
none                  2.0G     0  2.0G   0% /dev/shm
/dev/sda2             2.0G   53M  1.9G   3% /tmp
&lt;/pre&gt;
to this
&lt;pre&gt;
[root@app1 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda5             399G  227G  173G  57% /
/dev/sda1              99M   12M   82M  13% /boot
none                  2.0G     0  2.0G   0% /dev/shm
/dev/sda2             2.0G   52M  1.9G   3% /tmp
&lt;/pre&gt;</description>
      <pubDate>Tue, 03 Jun 2008 01:32:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:13bae53a-d323-454f-9633-2628a714a1a6</guid>
      <author>aalmazan@rackspace.com (alex almazan)</author>
      <link>http://alexalmazan.com/articles/2008/06/03/ext3-online-resize</link>
      <category>Linux Tips &amp; Tricks</category>
      <category>ext2online</category>
    </item>
  </channel>
</rss>
