LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 01-29-2017, 01:37 PM   #1
JockVSJock
Senior Member
 
Registered: Jan 2004
Location: DC
Distribution: RHEL/CentOS
Posts: 1,396
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
pvmove command shifts free space to wrong physical volume


I'm trying to move data off of a fdisk partition to a gdisk partition.

/dev/xvdf1 - is the fdisk partition
/dev/xvdg1 - is the gdisk partition

However when trying to move the free space from /dev/xvdf1 to /dev/xvdg1 using pvmove, the free space stays behind, thus I can't extend it out with lvextend command.

I'm not sure where I'm going wrong here:

Code:
[root@linuxacademy dev]# pvcreate /dev/xvdg1
  Physical volume "/dev/xvdg1" successfully created.

[root@linuxacademy dev]# vgextend battlestar /dev/xvdg1
  Volume group "battlestar" successfully extended

[root@linuxacademy dev]# vgdisplay
  --- Volume group ---
  VG Name               battlestar
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               9.99 GiB
  PE Size               4.00 MiB
  Total PE              2558
  Alloc PE / Size       1279 / 5.00 GiB
  Free  PE / Size       1279 / 5.00 GiB
  VG UUID               YzXp39-usMZ-rkeg-AMSM-KECs-upPo-quDY2W

[root@linuxacademy dev]# pvs
  PV         VG         Fmt  Attr PSize PFree
  /dev/xvdf1 battlestar lvm2 a--  5.00g    0
  /dev/xvdg1 battlestar lvm2 a--  5.00g 5.00g

[root@linuxacademy dev]# vgs
  VG         #PV #LV #SN Attr   VSize VFree
  battlestar   2   1   0 wz--n- 9.99g 5.00g

[root@linuxacademy dev]# pvmove /dev/xvdf1
  /dev/xvdf1: Moved: 0.00%
  /dev/xvdf1: Moved: 10.79%
  /dev/xvdf1: Moved: 20.95%
  /dev/xvdf1: Moved: 32.06%
  /dev/xvdf1: Moved: 43.86%
  /dev/xvdf1: Moved: 55.36%
  /dev/xvdf1: Moved: 67.40%
  /dev/xvdf1: Moved: 79.67%
  /dev/xvdf1: Moved: 91.40%
  /dev/xvdf1: Moved: 100.00%

[root@linuxacademy dev]# pvs
  PV         VG         Fmt  Attr PSize PFree
  /dev/xvdf1 battlestar lvm2 a--  5.00g 5.00g
  /dev/xvdg1 battlestar lvm2 a--  5.00g    0

[root@linuxacademy dev]# vgs
  VG         #PV #LV #SN Attr   VSize VFree
  battlestar   2   1   0 wz--n- 9.99g 5.00g

[root@linuxacademy dev]# vgreduce battlestar /dev/xvdf1
  Removed "/dev/xvdf1" from volume group "battlestar"

[root@linuxacademy dev]# pvs
  PV         VG         Fmt  Attr PSize PFree
  /dev/xvdf1            lvm2 ---  5.00g 5.00g
  /dev/xvdg1 battlestar lvm2 a--  5.00g    0

[root@linuxacademy dev]# vgs
  VG         #PV #LV #SN Attr   VSize VFree
  battlestar   1   1   0 wz--n- 5.00g    0

[root@linuxacademy dev]# lvextend -L 5G /dev/battlestar/galacctia
  Logical volume galacctia not found in volume group battlestar.

I don't understand why the free space moves from /dev/xvdg1 to /dev/xvdf1.

I also run vgreduce on /dev/xvdf1 to and no errors.

However when running lvextend against on /dev/xvdg1 there is no free space to extend it out with...

Not sure where I'm going wrong with this.
 
Old 01-29-2017, 01:56 PM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,554

Rep: Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088
When you run "pvmove /dev/xvdf1", all of the used extents on that volume get moved elsewhere, and the only "elsewhere" in this case is /dev/xvdg1. So, the 5.00g that had been in use on /dev/xvdf1 are now free (you moved that data away) and the 5.00g that had been free on /dev/xvdg1 is now in use (that's where you moved it to). What did you expect would happen?

Why did you then remove xvdf1 from the volume group? A logical volume can use only space that is within its volume group. Also, in that last command:
Quote:
Originally Posted by JockVSJock View Post
Code:
lvextend -L 5G /dev/battlestar/galacctia
I believe you misspelled "galactica", and thus the LV was not found. Also, "-L 5G" requests that the size be set to 5G, not extended by 5G.

Last edited by rknichols; 01-29-2017 at 02:01 PM. Reason: Also, ...
 
Old 01-29-2017, 03:04 PM   #3
JockVSJock
Senior Member
 
Registered: Jan 2004
Location: DC
Distribution: RHEL/CentOS
Posts: 1,396

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Why does the free space stay allocated to the physical volume?

When I run pvmove /dev/xvdf1, and then vgreduce the free space remains tied to the physical volume.

What I'm trying to do is use lvextend in the following way:

Code:
[root@linuxacademy dev]# lvextend -l +100%FREE /dev/battlestar/galactica
New size (5119 extents) matches existing size (5119 extents).
 
Old 01-29-2017, 03:31 PM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,554

Rep: Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088
Quote:
Originally Posted by JockVSJock View Post
Why does the free space stay allocated to the physical volume?

When I run pvmove /dev/xvdf1, and then vgreduce the free space remains tied to the physical volume.
That space is in disk sectors that are physically located on that volume.
Quote:
What I'm trying to do is use lvextend in the following way:

Code:
[root@linuxacademy dev]# lvextend -l +100%FREE /dev/battlestar/galactica
New size (5119 extents) matches existing size (5119 extents).
You have removed xvdf1 from the volume group, and now there is no free space in the volume group for extending your LV.

A "volume group" is a group of physical volumes that form a set from which space can be allocated to LVs. An LV can use only space that is within its volume group.
 
Old 01-30-2017, 09:58 PM   #5
JockVSJock
Senior Member
 
Registered: Jan 2004
Location: DC
Distribution: RHEL/CentOS
Posts: 1,396

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
This is where I went wrong, for /dev/xvdf1, I was allocating all of the free space and wasn't leaving anything behind. Therefore there was no space to move to /dev/xvdg1

If I only used 1 GB, instead of 20 GB, then there is 19 GB left over and this gets allocated to /dev/xvdg1 when using pvmove and vgreduce command.

thanks
 
  


Reply

Tags
lvm, pvmove, vgreduce


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create Logical Volume from free space of existing Volume Group? AdultFoundry Linux - Newbie 6 12-19-2016 05:59 AM
Removing Physical Disk from LVM via pvmove jamoody Linux - Newbie 2 07-07-2012 01:33 PM
how can increase my physical volume group space in linux ilu_nishant Linux - Newbie 3 09-12-2009 01:41 PM
What is wrong with reiserfs? wrong free space mesh2005 Linux - General 1 05-03-2007 07:21 AM
LVM Problem - vgimport - wrong number of physical volumes to import volume group Anything1 Linux - Software 0 09-06-2003 07:18 PM

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

All times are GMT -5. The time now is 06:23 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