Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Resizing hard disk in VMware, resize extended partition?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
1clue
Advocate
Advocate


Joined: 05 Feb 2006
Posts: 2549

PostPosted: Fri May 09, 2014 2:22 am    Post subject: Resizing hard disk in VMware, resize extended partition? Reply with quote

Hi.

Not really an installation question since it's already installed, but this is the closest I could find for topics.

I need to resize the extended partition on a guest disk I grew.

sda1=/boot
sda2=extended
sda5=lvm, containing everything else.

It started as 8g for some reason (probably I did it, but have no idea why) and sparse, so it wouldn't have made any difference had I made it 100g.

Or, let me rephrase this:

Is it easier/more reliable to grow the extended partition and then the LVM partition inside it or to create a new virtual disk, format it as GPT (as it should have been in the first place) create new partitions, mount them and then do some sort of tar wizardry to populate it? If it's reliable to copy over I would like to change the partition map and switch to GPT while I'm at it.

I'm dealing with a fairly heavily used VM for business. I need the minimum downtime I can get.

Thanks.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13831

PostPosted: Fri May 09, 2014 3:05 am    Post subject: Reply with quote

You could copy it all over, but unless that will re-sparse the disk, there is no point to it. You will need at least some downtime during the copy for a consistent image, so since you care about minimizing downtime, I suggest not doing such a copy.

Why do you want to switch to GPT? As far as I can see, none of the usual reasons for using it apply to your situation. Switching is unlikely to make the system perform better in any way. Writing a new disk as GPT is reasonable for new installs, but converting a working MBR to GPT seems like effort with no gain for your situation.

For minimal downtime, extend the existing partitions in place. You will need the VM down while the hypervisor grows the disk, but that may be quick if the hypervisor does not preallocate space for the added area. You will need to reboot to reload the partition table, since you cannot reload a table from a disk with mounted filesystems. If this was a data only drive, you could unmount everything, grow the partition, and reread the table without rebooting. You may want to boot into single user mode after growing the disk, then extend the partition, and then reboot from there. That will spare you a full startup/shutdown of all your regular services, so you can get back to a fully operational state sooner. I think you can grow the LVM while it is in use.
Back to top
View user's profile Send private message
1clue
Advocate
Advocate


Joined: 05 Feb 2006
Posts: 2549

PostPosted: Fri May 09, 2014 2:49 pm    Post subject: Reply with quote

The only real reason to go to GPT is that I think MBR partitions should be extinct. Personal preference. I still only need 2 partitions here, and I don't really understand why an extended partition was made in the first place.

My problem here is that I don't know how to resize the partitions. Everything online is to "extend" an ext3 (or whatever) partition, googling on resizing an "extended" partition is lost in the clutter. Parted suggests I do it with e2fsprogs or similar, but it's the extended partition so what do I use there?

I've been using lvm2 for a long time. When I install the VM I won't ever use an extended partition, I generally have no use for it. I don't know that I've ever resized an actual hard disk partition, whether real or virtual.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13831

PostPosted: Sat May 10, 2014 12:56 am    Post subject: Reply with quote

The easiest way to extend a partition is to note the current bounds, delete the partition, and create a new one with the same start location and a larger size. Deleting a partition does not modify the data in the area described by the partition, so if you get the start to align, your data will still be there.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43178
Location: 56N 3W

PostPosted: Sat May 10, 2014 10:09 am    Post subject: Reply with quote

1clue,

Add another Virtual Disk to the VM make it a single partition.
Add it to your existing volume group with vgextend.
Now ignore that your volume group is spread over several physical entities.

Use lvextend to make your logical volume(s) of choice bigger.
Finally, growe2fs (if you use extX) will grow the filesystem inside the logical volume.

No downtime required
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
1clue
Advocate
Advocate


Joined: 05 Feb 2006
Posts: 2549

PostPosted: Sat May 10, 2014 6:16 pm    Post subject: Reply with quote

Neddy,

I did exactly the same thing by adding a partition to the existing expanded disk, vgextend worked but it didn't work to resize the lv after that.

I figured a second disk wouldn't work if the second partition didn't work. Is there a technical difference with the process?

Or is my Linux image still convinced that the disk is 8g?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43178
Location: 56N 3W

PostPosted: Sat May 10, 2014 9:12 pm    Post subject: Reply with quote

1clue,

Don't think disks, think volume groups.
What does
Code:
sudo /sbin/vgdisplay
show?

lvresize needs some care
I prefer the
Code:
lvresize -L+
format as there is no danger of attempting to make the lv smaller, which fails if you try to make it smaller than the filesystem it holds.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum