Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have this:

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1217     9775552   83  Linux
/dev/sda2            1218       60801   478608480   83  Linux

And I'd like to shrink sda2 by about 10 Gigs to give some more space to sda1. sda2 is a PV on an LVM, but there is some free space in the VG so I don't have to worry about filesystem shrinking.

How can I tell my LVM to move the data off of the first 10 gigs of sda2 and then redo my partition table to give it to sda1?

(I don't have enough free space to just pvremove sda2, which would be the easy solution).

share|improve this question
    
If there is free space in your volume group, why don't you simply create a new volume and move some files over? –  Zoredache Nov 4 '09 at 5:37

2 Answers 2

up vote 2 down vote accepted

man pvresize.

But once you've done that, you'll have a somewhat bigger problem of shrinking sda2 and then relocating all of it to the end of your disk, since the reclaimed space will be at the end of the disk, and you need to get that space between right after the end of sda1.

share|improve this answer

You can use gparted/parted to move the partition/pv up.

share|improve this answer
1  
This is only true from the Oct 2012 release of Gparted 0.14.0 stable - earlier releases don't support moving PVs (LVM physical volumes): gparted.sourceforge.net/news.php?item=151 - the LVM code is new and apparently good quality, but backups are recommended of course as there is little experience with this feature yet. –  RichVel Nov 8 '12 at 6:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.