LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-15-2013, 08:08 AM   #1
karthik-naren
LQ Newbie
 
Registered: Jun 2013
Posts: 16

Rep: Reputation: 0
Unable to reduce the size of volume group?


Step1:
I have 3 lvm enabled partitions with sizes
300M,200M,100M.

Step2:
I converted them into physical volumes.

Step3:
I made volume group(VG) out of those physical volumes
i.e, total size of VG is 600M

Step4:
I created a logical volume of 100M under the (VG) volume group.
----------------------------------------------------
Now the volume left under the VG is 500M

Q:I want reduce the size of VG by 300M(500M-300M).
Please tell me the necessary commands and required explaination.

http://www.linuxquestions.org/questi...up-4175466124/

Last edited by karthik-naren; 06-15-2013 at 10:02 AM.
 
Old 06-15-2013, 08:19 AM   #2
karthik-naren
LQ Newbie
 
Registered: Jun 2013
Posts: 16

Original Poster
Rep: Reputation: 0
Unable to reduce the size of volume group?

Step1:
I have 3 lvm enabled partitions with sizes
300M,200M,100M.

Step2:
I converted them into physical volumes.

Step3:
I made volume group(VG) out of those physical volumes
i.e, total size of VG is 600M

Step4:
I created a logical volume of 100M under the (VG) volume group.
----------------------------------------------------
Now the volume left under the VG is 500M

Q:I want reduce the size of VG by 300M(500M-300M).
Please tell me the necessary commands and required explaination.


Code:
# lvdisplay
  --- Logical volume ---
  LV Name                /dev/drink/coke
  VG Name                drink
  LV UUID                8w5OmT-6u7F-80Eb-F3cX-KYYm-1USF-3g0I07
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                100.00 MB
  Current LE             25
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0




Code:
# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda8
  VG Name               drink
  PV Size               290.21 MB / not usable 2.21 MB
  Allocatable           yes 
  PE Size (KByte)       4096
  Total PE              72
  Free PE               47
  Allocated PE          25
  PV UUID               Z01VCO-DVL0-LENB-FtaU-CGQq-pphT-I9hEKD
   
  --- Physical volume ---
  PV Name               /dev/sda9
  VG Name               drink
  PV Size               196.08 MB / not usable 4.08 MB
  Allocatable           yes 
  PE Size (KByte)       4096
  Total PE              48
  Free PE               48
  Allocated PE          0
  PV UUID               JXp7NM-Bxul-ElSJ-ONjD-dYg8-I1s3-2n639W
   
  --- Physical volume ---
  PV Name               /dev/sda10
  VG Name               drink
  PV Size               101.94 MB / not usable 1.94 MB
  Allocatable           yes 
  PE Size (KByte)       4096
  Total PE              25
  Free PE               25
  Allocated PE          0
  PV UUID               9sTrmU-Brl2-yzT5-z3MO-o7P3-ksZ9-OE9O5d




Code:
# vgdisplay
  --- Volume group ---
  VG Name               drink
  System ID             
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               580.00 MB
  PE Size               4.00 MB
  Total PE              145
  Alloc PE / Size       25 / 100.00 MB
  Free  PE / Size       120 / 480.00 MB
  VG UUID               ACF0T4-B80c-iwhk-u6GN-t53Q-KnCj-nyp0B7



Code:
# lvs
  LV   VG    Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  coke drink -wi-a- 100.00M   


                                   
# pvs
  PV         VG    Fmt  Attr PSize   PFree  
  /dev/sda10 drink lvm2 a-   100.00M 100.00M
  /dev/sda8  drink lvm2 a-   288.00M 188.00M
  /dev/sda9  drink lvm2 a-   192.00M 192.00M



# vgs
  VG    #PV #LV #SN Attr   VSize   VFree  
  drink   3   1   0 wz--n- 580.00M 480.00M

Code:
# vgreduce /dev/drink /dev/sda8
  Physical volume "/dev/sda8" still in use

Last edited by karthik-naren; 06-16-2013 at 05:22 AM.
 
Old 06-15-2013, 09:11 AM   #3
xrgm
LQ Newbie
 
Registered: Dec 2012
Location: Joure, Netherlands
Posts: 7

Rep: Reputation: Disabled
You can remove one of the PVs from the VG bij the command vgreduce.

1. Check if the PV that you want to remove from the VG is not in use bij LVs:
# vgdisplay -v <VG>

2. If there are datablocks used on the PV that you want to remove from the VG, move them to another PV (PV tgt):
# pvmove <PV src> <PV tgt>

3. Delete the PV from the VG:
# vgreduce <VG> <PV>

4. Check
# vgdisplay -v <VG>
or
# pvdisplay <PV>

This all can be done without unmounting or rebooting.
 
1 members found this post helpful.
Old 06-15-2013, 12:30 PM   #4
cbtshare
Member
 
Registered: Jul 2009
Posts: 645

Rep: Reputation: 42
vgreduce can remove a pv, but since its pretty intuitive why convolute the scenario.Use vgreduce to reduce the VolumeGroup, to remove a pv, you use pvremove command.
 
Old 06-15-2013, 12:37 PM   #5
xrgm
LQ Newbie
 
Registered: Dec 2012
Location: Joure, Netherlands
Posts: 7

Rep: Reputation: Disabled
pvremove is not a good idea when the PV is still part of a VG. But step 5 could have been:
pvremove <PV>
 
Old 06-16-2013, 05:23 AM   #6
karthik-naren
LQ Newbie
 
Registered: Jun 2013
Posts: 16

Original Poster
Rep: Reputation: 0
As I try to reduce by one of the partitions it has
this is message am getting " Physical volume "/dev/sda8" still in use "



# vgreduce /dev/drink /dev/sda8
Physical volume "/dev/sda8" still in use

Last edited by karthik-naren; 06-16-2013 at 05:25 AM.
 
Old 06-16-2013, 05:40 AM   #7
karthik-naren
LQ Newbie
 
Registered: Jun 2013
Posts: 16

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by xrgm View Post
You can remove one of the PVs from the VG bij the command vgreduce.

1. Check if the PV that you want to remove from the VG is not in use bij LVs:
# vgdisplay -v <VG>

2. If there are datablocks used on the PV that you want to remove from the VG, move them to another PV (PV tgt):
# pvmove <PV src> <PV tgt>

3. Delete the PV from the VG:
# vgreduce <VG> <PV>

4. Check
# vgdisplay -v <VG>
or
# pvdisplay <PV>

This all can be done without unmounting or rebooting.

Thanks!!

For Ur Reply it was helpful!!

As U said

"1. Check if the PV that you want to remove from the VG is not in use bij LVs:
# vgdisplay -v <VG> "


I did and then removed the ones which are not in use!!

Code:
# vgdisplay -v /dev/drink
    Using volume group(s) on command line
    Finding volume group "drink"
  --- Volume group ---
  VG Name               drink
  System ID             
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               580.00 MB
  PE Size               4.00 MB
  Total PE              145
  Alloc PE / Size       25 / 100.00 MB
  Free  PE / Size       120 / 480.00 MB
  VG UUID               ACF0T4-B80c-iwhk-u6GN-t53Q-KnCj-nyp0B7
   
  --- Logical volume ---
  LV Name                /dev/drink/coke
  VG Name                drink
  LV UUID                8w5OmT-6u7F-80Eb-F3cX-KYYm-1USF-3g0I07
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                100.00 MB
  Current LE             25
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
   
  --- Physical volumes ---
  PV Name               /dev/sda8     
  PV UUID               Z01VCO-DVL0-LENB-FtaU-CGQq-pphT-I9hEKD
  PV Status             allocatable
  Total PE / Free PE    72 / 47
   
  PV Name               /dev/sda9     
  PV UUID               JXp7NM-Bxul-ElSJ-ONjD-dYg8-I1s3-2n639W
  PV Status             allocatable
  Total PE / Free PE    48 / 48
   
  PV Name               /dev/sda10     
  PV UUID               9sTrmU-Brl2-yzT5-z3MO-o7P3-ksZ9-OE9O5d
  PV Status             allocatable
  Total PE / Free PE    25 / 25
Before i was trying remove the one which is in use!!

Code:
# vgreduce /dev/drink /dev/sda8
  Physical volume "/dev/sda8" still in use

Code:
# vgreduce /dev/drink /dev/sda{9,10}
  Removed "/dev/sda9" from volume group "drink"
  Removed "/dev/sda10" from volume group "drink"
Code:
# vgs
  VG    #PV #LV #SN Attr   VSize   VFree  
  drink   1   1   0 wz--n- 288.00M 188.00M


Got it!!

Last edited by karthik-naren; 06-16-2013 at 05:52 AM.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I have spce in volume group but it can not increase the size of logical volume anis123 Linux - Newbie 14 04-16-2012 06:23 AM
Unable to reduce the size of volume group? pinga123 Linux - Newbie 3 01-04-2012 01:23 AM
[SOLVED] Increase the Total Size of LVM Volume Group ? The Unincorporated Man Linux - Server 2 11-06-2011 11:25 PM
how to extend volume group size over the remaining space scrat75 Linux - Software 3 03-29-2010 03:51 PM
Can I increase the size of a physical volume in an lvm group? If so, how? MikeB23930 Fedora 2 07-21-2009 05:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:32 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration