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

i had 2 partitions with following layout

Disk /dev/xvda: 376.4 GB, 376354897920 bytes
255 heads, 63 sectors/track, 45755 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000da515

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/xvda2              64        2613    20468736   8e  Linux LVM
/dev/xvda3            2613        7835    41948160   8e  Linux LVM

I accidentally gave 350GB of space to this disk, but i wanted it to be 100GB, now i can make another 100GB volume from SAN, and want its data to be moved to that disk with 100GB size.

I have already tried to use gparted, parted, but none worked for me. even DD is not working in this scenario. may be clonezille would be helpful?

Thanks

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Short form: you want pvmove.

Longer form: First, you'll need to create the new SAN disk, then pvcreate the physical volume on that new device. Once you've done that, you can use pvmove to relocate the logical volume(s) you wish moved. For example, to move the logical volume named lv.home1 from xvda3 to xvdb1 (device names chosen at random), you would issue:
pvmove --name lv.home1 /dev/xvda3 /dev/xvdb1
See man pvmove for details of the pvmove command.

share|improve this answer
    
but is it possible that i can merge all of the LVMs into one LVM on destination disk? –  Farhan Sep 30 '13 at 12:59
    
I'm not sure what you mean. You can move all LV's into the same VG, merging multiple LVs into a single LV is done via an OS level copy, not LVM operations. –  John Sep 30 '13 at 13:07
    
ok, nevermind, got it. Thanks for the answer –  Farhan Sep 30 '13 at 13: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.