Fedora Linux Support Community & Resources Center
  #1  
Old 17th September 2011, 07:54 AM
Renich Offline
Registered User
 
Join Date: May 2005
Location: Guadalajara, Jalisco, México
Age: 33
Posts: 145
linuxchrome
Resizing an LVM2 partition (PV)

Hello,

First, a little explanation of where I am standing:

I have a virtual instance of Fedora 16 running on KVM/Qemu.
The partition table is simple: /boot (500 MB) and lv_root (5.5 GB) (yes, no swap).
Now, I resized the fedora HDD image with qemu-img. It was 6 GB and now it's 7 GB.

I'd like to resize the lvm partition /dev/vda2
how can I do that?

lvresize is not working; neither is pvresize.

I'm trying to make a script that resizes (extends, no reduction) your partition (using rc.local) at boot time. Automatic resizing, eh?

Anyway, I'd appreciate some help regarding the /dev/vda2 resize. It should be better if it's a one-liner; requiring no user interaction.

---------- Post added at 01:51 AM ---------- Previous post was at 12:30 AM ----------

Ok, it's solved. Here's what I did:

First, delete and recreate the partition table:


Code:
gdisk /dev/vda (yep, I'm using GPT)
d 2 <enter>
n 2 <enter>
<enter>
<enter>
<enter>
8e00 (this should be your partition type. In this case, this one is a LVM partition)
w (don't forget to write the partition table)
Then, very important, run:
Code:
partprobe
in order to update the partitions on your OS. I had to reboot after this... ;=s

Then, everything is sooooo simple:

Code:
pvresize /var/vda2
lvresize -r -l +100%FREE /dev/mapper/vg_f16-lv_root
Done!

I'd still would like to automate this. Any bash script proposal (/etc/rc.local) is appreciated!
__________________
It's hard to be free, but I love to struggle!
You don't ask for love; you give it. You don't ask for respect; you earn it!

Renich Bon Ciric
]http://woralelandia.com/

Last edited by Renich; 28th September 2012 at 02:54 PM. Reason: I'm making the resize code clearer and easier to understand
Reply With Quote
  #2  
Old 26th September 2012, 09:25 PM
shisatum Offline
Registered User
 
Join Date: Sep 2012
Location: NC
Posts: 3
windows_7chrome
Re: Resizing an LVM2 partition (PV)

Renich, I'm having the same issue. I did not think this through before acting.
I typed this from the GParted LiveCD: (sda2 is my fedora partition)

gdisk /dev/sda2
d 2
n 2 <enter>, <enter>, <enter>...
w

When I typed partprobe, it did not work, now the file system is still there but it is unrecognizable. What can I attempt to recover the home file? It is all I need.

Thanks in advance for any help!

Last edited by shisatum; 26th September 2012 at 09:28 PM.
Reply With Quote
  #3  
Old 27th September 2012, 01:27 AM
Renich Offline
Registered User
 
Join Date: May 2005
Location: Guadalajara, Jalisco, México
Age: 33
Posts: 145
linuxchrome
Re: Resizing an LVM2 partition (PV)

Quote:
Originally Posted by shisatum View Post
Renich, I'm having the same issue. I did not think this through before acting.
I typed this from the GParted LiveCD: (sda2 is my fedora partition)

gdisk /dev/sda2
d 2
n 2 <enter>, <enter>, <enter>...
w

When I typed partprobe, it did not work, now the file system is still there but it is unrecognizable. What can I attempt to recover the home file? It is all I need.
!
Well, I think you got the partition type wrong. Most probably, you have LVM so, try gdisk again, but, this time:

Code:
gdisk /dev/sda <enter>
d 2 <enter>
n 2 <enter>
<enter>
<enter>
<enter>
8e00
__________________
It's hard to be free, but I love to struggle!
You don't ask for love; you give it. You don't ask for respect; you earn it!

Renich Bon Ciric
]http://woralelandia.com/
Reply With Quote
  #4  
Old 27th September 2012, 02:16 AM
shisatum Offline
Registered User
 
Join Date: Sep 2012
Location: NC
Posts: 3
windows_7chrome
Re: Resizing an LVM2 partition (PV)

Thank you,

I have now done this and it appeared to work, yet the partition is still recognized as unknown and when I attempt to boot I am stuck at the the grub bootloader.
Reply With Quote
  #5  
Old 27th September 2012, 04:03 AM
Renich Offline
Registered User
 
Join Date: May 2005
Location: Guadalajara, Jalisco, México
Age: 33
Posts: 145
linuxchrome
Re: Resizing an LVM2 partition (PV)

Quote:
Originally Posted by shisatum View Post
Thank you,

I have now done this and it appeared to work, yet the partition is still recognized as unknown and when I attempt to boot I am stuck at the the grub bootloader.
You might want to check /etc/fstab

I am sure it has a UUID reference. Remove that and use /dev/sda2 instead. The UUID surely changed.
__________________
It's hard to be free, but I love to struggle!
You don't ask for love; you give it. You don't ask for respect; you earn it!

Renich Bon Ciric
]http://woralelandia.com/
Reply With Quote
  #6  
Old 27th September 2012, 04:22 AM
shisatum Offline
Registered User
 
Join Date: Sep 2012
Location: NC
Posts: 3
windows_7chrome
Re: Resizing an LVM2 partition (PV)

cat fstab is:

aufs / aufs rw 0 0
tmpfs /tmp tmpfs nosuid,nodev 0 0
Reply With Quote
  #7  
Old 27th September 2012, 05:46 AM
Renich Offline
Registered User
 
Join Date: May 2005
Location: Guadalajara, Jalisco, México
Age: 33
Posts: 145
linuxchrome
Re: Resizing an LVM2 partition (PV)

Huh? That can't be. Were is your system?

I think you booted on a LiveCD or something and then tried cat /etc/fstab

If you're using the Fedora Rescue CD, be sure to let it find a system and ask it to mount it. Then, just cat /mnt/sysimage/etc/fstab
__________________
It's hard to be free, but I love to struggle!
You don't ask for love; you give it. You don't ask for respect; you earn it!

Renich Bon Ciric
]http://woralelandia.com/
Reply With Quote
  #8  
Old 28th September 2012, 12:20 PM
anishjp Offline
Registered User
 
Join Date: Sep 2009
Location: Johannesburg, South Africa
Posts: 255
windows_7firefox
Re: Resizing an LVM2 partition (PV)

Quote:
Originally Posted by Renich View Post
Hello,

I have a virtual instance of Fedora 16 running on KVM/Qemu.
The partition table is simple: /boot (500 MB) and lv_root (5.5 GB) (yes, no swap).
Now, I resized the fedora HDD image with qemu-img. It was 6 GB and now it's 7 GB.

I'd like to resize the lvm partition /dev/vda2
how can I do that?

lvresize is not working; neither is pvresize.

I'm trying to make a script that resizes (extends, no reduction) your partition (using rc.local) at boot time. Automatic resizing, eh?
Do you see the the free space in your volume group after increasing the HDD size? Check if there are any free physical extends in your volume group

Code:
Code:
vgscan
:- displays all your volume groups
Code:
vgdisplay /dev/*****volume group name of lv_root****
lvextend -n /dev/volume_group_name/lv_root -L mazimum sizeM fsck -f /dev/volume_group_name/lv_root resize2fs -p /dev/mapper/volume group name-lv_root
check the size of the new file system

Code:
df -h
logical volume extension should be done very carefuly or you may break ur system!
__________________
Host Machine
OS: Fedora 20, Desktop: Gnome, Kernel: 3.11.fc20.x86_64, Processor: Intel i3-2100 @ 3.10GHz, RAM: 8GB
Motherboard: ASUS P8H61-M LE/USB3, Display: Mecer LCD 1280x1024, Benq LCD 1280x1024, Hisense LCD 1920x Graphics: ATI Radeon HD 5450

Last edited by anishjp; 28th September 2012 at 12:25 PM.
Reply With Quote
Reply

Tags
kvm/qemu, lvm2, resize

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Recover LVM2 Partition Table Issue ondemanddesign Using Fedora 0 14th July 2011 11:40 PM
Convert LVM2 partition to static partition slamp Using Fedora 0 3rd December 2007 08:53 PM
Resizing Partition? fvs Installation, Upgrades and Live Media 2 11th May 2006 01:44 PM


Current GMT-time: 11:52 (Saturday, 25-10-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
Conselheiro Lafaiete - Lambersart - Tharangambadi Instagram Photos