Fedora Linux Support Community & Resources Center
  #1  
Old 23rd November 2009, 03:06 PM
Sagitter Offline
Registered User
 
Join Date: Sep 2009
Location: Salento - Italy
Age: 33
Posts: 520
linuxfedorafirefox
Remove unused space from Vg LVM2

Hi to all,

this is my situation: on a LVM2 partition, i have shrink a logical volume to free new space for a new partition.

My system-config-lvm screen: http://forums.fedoraforum.org/attach...1&d=1258988216

Outputs:

Code:
# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               test_vg
  PV Size               3.68 GB / not usable 701.05 MB
  Allocatable           yes 
  PE Size (KByte)       1048576
  Total PE              3
  Free PE               1
  Allocated PE          2
  PV UUID               NNa3jQ-Pil1-hkIV-BPtb-0Y8v-NWbB-XkfsRH
Code:
# vgdisplay
  --- Volume group ---
  VG Name               test_vg
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  6
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               3.00 GB
  PE Size               1.00 GB
  Total PE              3
  Alloc PE / Size       2 / 2.00 GB
  Free  PE / Size       1 / 1.00 GB
  VG UUID               Zf0m1R-DXrr-ixrq-4bG7-kQNq-PX6X-SVum33
Code:
# lvdisplay
  --- Logical volume ---
  LV Name                /dev/test_vg/lvol0
  VG Name                test_vg
  LV UUID                id7Emy-Sj5W-2e1X-57RD-lFua-5tlp-3q0Qgv
  LV Write Access        read/write
  LV Status              NOT available
  LV Size                1.00 GB
  Current LE             1
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
   
  --- Logical volume ---
  LV Name                /dev/test_vg/lvol1
  VG Name                test_vg
  LV UUID                GBmXa1-RYrH-ggy0-f09X-ByIt-4B1H-K23shR
  LV Write Access        read/write
  LV Status              NOT available
  LV Size                1.00 GB
  Current LE             1
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
Code:
# vgs
  VG      #PV #LV #SN Attr   VSize VFree
  test_vg   1   2   0 wz--n- 3.00G 1.00G
I have tried to export out from LVM, the new free space by these command:

Code:
# vgreduce -a test_vg
or
Code:
# vgreduce --removemissing test_vg
but without success.

Where am I wrong?
Thanks.

Sagitter
Attached Thumbnails
Click image for larger version

Name:	lvm.jpg
Views:	462
Size:	35.2 KB
ID:	18531  
__________________
Homepage: http://www.fedoraos.wordpress.com
Wiki page: https://fedoraproject.org/wiki/User:Sagitter
Reply With Quote
  #2  
Old 23rd November 2009, 04:32 PM
SlowJet Offline
Registered User
 
Join Date: Jan 2005
Posts: 5,048
linuxfedorafirefox
"i have shrink a logical volume to free new space for a new partition."

That only makes freespace in the VG, the PV(and underlying 8e partition) has not changed.
The new VG freespace can be used for another LV.

PE Size 1.00 GB - This s/b 4MB and is the default( or 32MB for big LV's or many PV/VG's)

I recommend starting over with the sdb1,
and use command line.
But I don't know what your intentions are, new LV, new partition for ?, just confused at 701MB of wasted space? so ...

SJ
__________________
Do the Math
Reply With Quote
  #3  
Old 23rd November 2009, 04:41 PM
Sagitter Offline
Registered User
 
Join Date: Sep 2009
Location: Salento - Italy
Age: 33
Posts: 520
linuxfedorafirefox
Hi Slowjet,

Quote:
But I don't know what your intentions are, new LV, new partition for ?, just confused at 701MB of wasted space? so ...
I want to take out free space, from volume group; to have new unallocated partition.
__________________
Homepage: http://www.fedoraos.wordpress.com
Wiki page: https://fedoraproject.org/wiki/User:Sagitter
Reply With Quote
  #4  
Old 23rd November 2009, 04:57 PM
SlowJet Offline
Registered User
 
Join Date: Jan 2005
Posts: 5,048
linuxfedorafirefox
lvm pvremove /dev/sdb1

fdisk /dev/sdb1

remove the the partition
create new sdb partitions as needed (with size, type)

when done, save the partition table and exit.

formart each partition with the correct file system according to it type.

83 mkfs.ext4 /dev/sdbn
82 mkswap /dev/sdbn


SJ.
__________________
Do the Math

Last edited by SlowJet; 23rd November 2009 at 04:59 PM.
Reply With Quote
  #5  
Old 23rd November 2009, 05:05 PM
Sagitter Offline
Registered User
 
Join Date: Sep 2009
Location: Salento - Italy
Age: 33
Posts: 520
linuxfedorafirefox
Code:
# lvm pvremove /dev/sdb1
  Can't pvremove physical volume "/dev/sdb1" of volume group "test_vg" without -ff

# pvremove -ff  /dev/sdb1
Really WIPE LABELS from physical volume "/dev/sdb1" of volume group "test_vg" [y/n]? y
  WARNING: Wiping physical volume label from /dev/sdb1 of volume group "test_vg"
  Labels on physical volume "/dev/sdb1" successfully wiped

# vgdisplay
#
Remove LVM. I don't want that.


I wish to take off only the unused space.

Click image for larger version

Name:	lvm.jpg
Views:	186
Size:	35.2 KB
ID:	18532
__________________
Homepage: http://www.fedoraos.wordpress.com
Wiki page: https://fedoraproject.org/wiki/User:Sagitter

Last edited by Sagitter; 23rd November 2009 at 05:18 PM.
Reply With Quote
  #6  
Old 23rd November 2009, 05:19 PM
SlowJet Offline
Registered User
 
Join Date: Jan 2005
Posts: 5,048
linuxfedorafirefox
That's a safety feature.
I assume you have not extended any LV onto the test_vg (according to the vgdisplay and lvdisplay)


remove each piece

lvm lvremove /dev/mapper/test_vg-lvol1 /dev/mapper/test_vg-lvol0
lvm vgremove test_vg
lvm pvremove /dev/sdb1

SJ
__________________
Do the Math
Reply With Quote
  #7  
Old 23rd November 2009, 05:26 PM
Sagitter Offline
Registered User
 
Join Date: Sep 2009
Location: Salento - Italy
Age: 33
Posts: 520
linuxfedorafirefox
I will try later, thank you.
__________________
Homepage: http://www.fedoraos.wordpress.com
Wiki page: https://fedoraproject.org/wiki/User:Sagitter

Last edited by Sagitter; 23rd November 2009 at 08:55 PM.
Reply With Quote
  #8  
Old 23rd November 2009, 08:01 PM
SlowJet Offline
Registered User
 
Join Date: Jan 2005
Posts: 5,048
linuxfedorafirefox
Quote:
Originally Posted by Sagitter View Post
Code:
# lvm pvremove /dev/sdb1
  Can't pvremove physical volume "/dev/sdb1" of volume group "test_vg" without -ff

# pvremove -ff  /dev/sdb1
Really WIPE LABELS from physical volume "/dev/sdb1" of volume group "test_vg" [y/n]? y
  WARNING: Wiping physical volume label from /dev/sdb1 of volume group "test_vg"
  Labels on physical volume "/dev/sdb1" successfully wiped

# vgdisplay
#
Remove LVM. I don't want that.


I wish to take off only the unused space.

Attachment 18532
Well, I didn't see the forced part with the y.
But sdb1 is just a partition of type 8e now.
You had to remove LV's and VG to get rid of the 1GB PE size anyway.
You can not define a partition inside a PV/VG freespace.
So make the 8e partition for LVM smaller if you really want another partition(s).
otherwise
lvm pvcreate /dev/sdb1
lvm vgcreate --physicalextentsize 4M VolGroup1101 /dev/sdb1

then you can create LV's as needed.
lvm lvcreate --size nnnnM --name LogVol1101bkup VolGroup1101 /dev/sdb1

SJ
__________________
Do the Math
Reply With Quote
  #9  
Old 24th November 2009, 11:07 AM
Sagitter Offline
Registered User
 
Join Date: Sep 2009
Location: Salento - Italy
Age: 33
Posts: 520
linuxfedorafirefox
Quote:
Well, I didn't see the forced part with the y.
But sdb1 is just a partition of type 8e now.
You had to remove LV's and VG to get rid of the 1GB PE size anyway.
You can not define a partition inside a PV/VG freespace.
So make the 8e partition for LVM smaller if you really want another partition(s).
otherwise
lvm pvcreate /dev/sdb1
lvm vgcreate --physicalextentsize 4M VolGroup1101 /dev/sdb1

then you can create LV's as needed.
lvm lvcreate --size nnnnM --name LogVol1101bkup VolGroup1101 /dev/sdb1
Ok. Thank you.
__________________
Homepage: http://www.fedoraos.wordpress.com
Wiki page: https://fedoraproject.org/wiki/User:Sagitter
Reply With Quote
  #10  
Old 15th June 2011, 04:28 AM
gattler Offline
Registered User
 
Join Date: May 2011
Posts: 6
linuxfirefox
Re: Remove unused space from Vg LVM2

Can someone please provide a simple ABC, child and fire proof step-to-step guide on how to

1) EXTRACT Unused Space from a Volume Group
2) CREATE a good old fashioned Partition out of this afformentioned Unused Space.

This can't be so hard, can it? I really miss the old days of pre-LVM.
__________________
http://meshfields.de
Reply With Quote
  #11  
Old 10th October 2013, 05:15 PM
derekge Offline
Registered User
 
Join Date: Sep 2013
Location: San Diego
Posts: 13
windows_7chrome
Re: Remove unused space from Vg LVM2

Quote:
Originally Posted by gattler View Post
Can someone please provide a simple ABC, child and fire proof step-to-step guide on how to

1) EXTRACT Unused Space from a Volume Group
2) CREATE a good old fashioned Partition out of this afformentioned Unused Space.

This can't be so hard, can it? I really miss the old days of pre-LVM.
Yes, I'm looking for the same thing. I tried Gparted live but it won't let me resize my "lvm2pv" partition. It currently reads "0.00B unused space"

Thanks in advance!
Reply With Quote
  #12  
Old 11th October 2013, 08:35 AM
george_toolan Offline
Registered User
 
Join Date: Dec 2006
Posts: 2,078
linuxfirefox
Re: Remove unused space from Vg LVM2

Please don't resurrect old threads like this.

You should rather start a new one in the software section explaining your LVM setup in detail and what you are trying to accomplish.

You can use the display commands from the first post.
Reply With Quote
Reply

Tags
lvm2, remove, space, unused

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
clean up unused dependencies jspaceman Using Fedora 1 14th June 2008 10:29 AM
Remove unused dependencies? sheep Using Fedora 1 5th July 2006 12:34 AM
Remove unused locales? ansorg Using Fedora 2 19th May 2006 09:49 AM
Remove LVM2 from system joaster Using Fedora 1 28th March 2006 05:18 AM
unused modules loaded? rsk Hardware & Laptops 1 20th September 2005 06:36 AM


Current GMT-time: 08:07 (Monday, 20-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
Jinchang - Portmore - Beerse