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.

How can I move a Logical Volume from one volume group on /dev/sda to a new disk /dev/sdb which has a new volume group on it?

share|improve this question

3 Answers 3

up vote 6 down vote accepted

I did something similar a while back when I used LVM to migrate filesystems between a regular drive and a raid array. Basically you grow the existing logical volume onto the new disk and and use pvmove to migrate the existing filesystems to the new drive.

share|improve this answer
    
Hi Phil, I have just started the same process...:) Thanks! –  ard Jan 29 '11 at 20:06
    
+1 At my previous job we did this to migrate extents off RAID arrays that were being retired to newer storage arrays. But the new storage arrays had to be added to the existing Volume Group as @packs eludes to. –  3dinfluence Jan 29 '11 at 20:07
    
I've used pvmove in the past to replace disks in the past. Works great, but you have to be careful with how your VGs are arranged. –  Scott Pack Jan 30 '11 at 0:26

It is probably easiest to create a snapshot of your existing LV, and simply use something like 'dd' to write, block level, i.e. /dev/mapper/vg_your_old_group/lv_snapshot_name to /dev/mapper/vg_your_new_group/lv_name.

Make sure that when you do 'dd' your /dev/mapper/vg_your_new_group/lv_name is not mounted. Snapshots are almost instantaneousness, assuming you have enough space to create a snapshot in your original VG.

share|improve this answer

Technically, you can't. The logical volume is intrinsically tied to the underlying volume group. Since you created a new VG then your best option will be to translate the following psuedo-code into the commands most relevant to your system

  1. create a new LV on your new VG
  2. format your new LV with your filesystem of choice
  3. mount your new LV in a temporary location
  4. copy the data from old_lv to new_lv (cp, tar, rsync, whatever)
  5. lvremove old_lv
share|improve this answer
    
there's vgmerge, dude –  poige Feb 1 '11 at 6:21

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.