LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 04-05-2013, 06:09 AM   #1
tripialos
Member
 
Registered: Apr 2012
Posts: 112

Rep: Reputation: Disabled
Partition Expansion DEBATE


Greetings

I am having a debate with my colleague regarding the below case and i would really like to hear your opinions:

Scenario:

You have an alix PC engines board which carries an 80GB HDD with CentOS 5.5 installed. You image the hard drive because you know that you will make ten (10) more of such systems with the exact same hardware.

Partitions:
hda1 - / (mount point) - 30GB
hda2 - ext3 (or LVM) - 50GB

Now, you are trying to clone the system which means you get the new hardware , which as stated is is exactly the same, and you copy the image to the new HDD.

BUT

The new hard drive is not 80GB it is 120GB, and i am asking:

1) When you dd the image (of 80GB) to the 120GB disk and connected to the system, what will CentOS recognize?
I mean will the OS have the partitions as before and recognize the rest space as free?

2) Million dollar question:

In case the OS will recognize the rest space as free, and we are able to use it, if we want to expand the hda1 partition will the procedure be the same with LVM or ext3?

I mean if we want to expand the rest space to the hda2 (second partition) would it be easier if the particular partition is an LVM or just an ordinary ext3.


Thanks

Last edited by tripialos; 04-05-2013 at 06:12 AM.
 
Old 04-05-2013, 04:08 PM   #2
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,284

Rep: Reputation: 136Reputation: 136
Quote:
When you dd the image (of 80GB) to the 120GB disk and connected to the system, what will CentOS recognize?
I mean will the OS have the partitions as before and recognize the rest space as free?
Not from within CentOS. You will have to use a bootable partitioning cd like PartedMagic or Gparted which will see the free, unallocated space on the drive and allow you to expand the adjacent partition to include the unallocated space. Once gparted writes the expanded partition to the partition table, on reboot CentOS will see the everything and recognize the partition has been enlarged.
 
Old 04-05-2013, 05:51 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 11,827

Rep: Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927
Nope. Once you "dd" the image over the target drive, the drive geometry (basically cylinder count) will be replaced. Your 120 Gig will magically become an 80 Gig drive.

Yet another reason to stay away from "dd". Use a kickstart or something like clonezilla - it is data aware. They also have a multicast option which I've not looked at.
 
Old 04-06-2013, 03:01 AM   #4
tripialos
Member
 
Registered: Apr 2012
Posts: 112

Original Poster
Rep: Reputation: Disabled
So there is no way, somehow, to achieve this WITHIN the OS even if the partitions were LVM. For isntance, what if you have an LVM volume consisted of 2 partitions and then you make the unallocated space a new LVM partition and add it to your existed with result expanding its storage? Is that possible?
 
Old 04-06-2013, 10:20 AM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 1,180

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
For an ext3 or ext4 (not ext2) filesystem that was built with the "resize-inode" feature, kernel versions 2.6 and up support online resizing. See the manpage for resize2fs for details. You have several options for doing this, both with and without LVM, but working from within the OS, the size of that 30GB non-LVM root filesystem would be very hard to change. Expanding that second partition and filesystem(s) within it, however, is fairly straightforward.

Without LVM:
  1. Use fdisk to delete the second partition and the re-create it with the same starting point and extending to the end of the disk. You will be prompted to reboot.
  2. After rebooting, use resize2fs to extend the filesystem to fill that second partition.

With LVM - Method A: Expand existing partition:
  1. As above, use fdisk to delete the second partition and the re-create it with the same starting point and extending to the end of the disk. You will be prompted to reboot.
  2. After rebooting, use pvextend to extend the existing LVM physical volume to include the new space.
  3. Use lvextend to add space to the existing logical volume(s).
  4. Use resize2fs to extend the filesystem(s) to fill their enlarged logical volume(s).

With LVM - Method B: Add a new partition (safest):
  1. Use fdisk to add a third partition using the free space on the disk. You will be prompted to reboot.
  2. After rebooting, use pvcreate to set up that third partition as an LVM physical volume.
  3. Use vgextend to add the new physical volume to the existing volume group.
  4. Use lvextend to add space to the existing logical volume(s).
  5. Use resize2fs to extend the filesystem(s) to fill their enlarged logical volume(s).

Note that this fairly simple case is easier without LVM, but using LVM would allow you to have more than one filesystem in that second partition and make it easier to redistribute the space (perhaps adding an additional drive) in the future.

Last edited by rknichols; 04-06-2013 at 10:23 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
* expansion prasunjit Linux - Newbie 4 12-12-2012 07:10 AM
LXer: OOXML: Why the debate? LXer Syndicated Linux News 0 03-07-2008 02:51 AM
Debate forum? zhangmaike LQ Suggestions & Feedback 5 05-06-2005 11:17 AM
PC vs. MAC vs. LINUX debate ? dolphans1 General 12 09-16-2004 01:34 AM
Partition Expansion Idea Breezwell Linux - General 2 12-19-2003 04:06 PM


All times are GMT -5. The time now is 12:49 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration