Skip to contentSkip to conversation

Shrinking a LVM physical volume

linux-lvm Drew 4 participants 4 messages Mar 24, 2009 – Mar 26, 2009

lore
Share & tools
lore

Drew

author
#0 lore raw

Hi there,

I have a system that I dual boot Windows and Debian from. Due to a minor mistake on my part when carving out the space on my drive for my linux partition, I now find myself with insufficient space on my windows partition.

How do you shrink a physical volume on lvm? And then once that's done, how safe is it to move the lvm partition around on the drive?

Signature · 4 lines
Drew

"Nothing in life is to be feared. It is only to be understood."
--Marie Curie
#1 lore raw
Quoted 6 lines · Drew

I have a system that I dual boot Windows and Debian from. Due to a minor mistake on my part when carving out the space on my drive for my linux partition, I now find myself with insufficient space on my windows partition.

How do you shrink a physical volume on lvm?

Since nobody with real experience doing that has answered, I'll supply my fewer than 2 Eurocents...

According to its manpage, it should be safe to use
pvresize --setphysicalvolumesize <newsize> <pvdevice>
prior to resizing the partition. It should complain if there are extents in use beyond <newsize>.

I say "it should" because I never tried it. So make a backup, blahblah, etcetera...

Quoted 2 lines

And then once that's done,
how safe is it to move the lvm partition around on the drive?

That is up to somebody with more knowledge to answer.

HTH,
Lupe Christoph

Signature · 2 lines
| There is no substitute for bad design except worse design.                   |
| /me                                                                          |
#2 lore raw
Quoted 11 lines · Lupe Christoph
Quoted 6 lines · Drew

I have a system that I dual boot Windows and Debian from. Due to a minor mistake on my part when carving out the space on my drive for my linux partition, I now find myself with insufficient space on my windows partition.

How do you shrink a physical volume on lvm?

Since nobody with real experience doing that has answered, I'll supply my fewer than 2 Eurocents...

Good answer, Lupe.

One other thing to be aware of; you should know the amount of space that has been allocated within the Physical Volume. If that amount exceeds the amount that you wish to recover, you may be able to shrink Logical Volumes within the Physical Volume, but, of course, before doing so, you should shrink the filesystems that are contained within the logical volumes.

Have fun!
Brian

#3 lore raw
In reply to Lupe Christoph
Quoted 4 lines

According to its manpage, it should be safe to use
pvresize --setphysicalvolumesize <newsize> <pvdevice>
prior to resizing the partition. It should complain if there are extents in use beyond <newsize>.

Is there some way to move those extents?
I guess there's pvmove, but that seems to only be able to move them to some other PV.

Quoted 3 lines
Quoted 2 lines

And then once that's done,
how safe is it to move the lvm partition around on the drive?

That is up to somebody with more knowledge to answer.

I can confirm that PVs can be moved at will (even between drives). I've done it a few times.

Stefan