1

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

Farhan
  • 4,269
  • 11
  • 49
  • 80

1 Answers1

1

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.

John
  • 9,070
  • 1
  • 29
  • 34
  • 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