1 |
Am 30.03.2011 05:02, schrieb Einux: |
2 |
> Hi, |
3 |
> |
4 |
> I bought a new 1T harddrive which is exactly the same as my previous |
5 |
> harddrive. So I'm planning to make a Raid-1 layout(for security |
6 |
> reasons). But here's the problem: I've already setup LVM2 on the |
7 |
> existing harddrive and I don't want to destroy the existing LVM volume |
8 |
> groups. I tried to google it, but I'm not sure which is the right keyword. |
9 |
> Could you guys help me out? |
10 |
> |
11 |
> Thanks in advance:) |
12 |
> |
13 |
> -- |
14 |
> Best Regards, |
15 |
> Einux |
16 |
> |
17 |
|
18 |
1. Create a degenerated RAID1 with your new disk |
19 |
mdadm --create /dev/md0 --level=1 --raid-devices=2 missing /dev/sdb |
20 |
|
21 |
2. Partition the raid device |
22 |
|
23 |
3. Add one of the partitions to your LVM volume group. |
24 |
pvcreate /dev/sdb2 |
25 |
vgextend volume_group /dev/sdb2 |
26 |
|
27 |
4. Move everything from the old physical volumes to the new pv. |
28 |
pvmove /dev/sda3 /dev/sdb2 |
29 |
|
30 |
5. Remove the old and now empty physical volume |
31 |
vgreduce volume_group /dev/sda3 |
32 |
|
33 |
6. Move everything else which is not on LVM to your new raid. Guess you |
34 |
need to go to single user mode to do this safely. |
35 |
|
36 |
7. Grow your raid to also contain the old disk. |
37 |
mdadm /dev/md0 -a /dev/sda |
38 |
|
39 |
No, I have not tested this and you should double-check everything. No |
40 |
guarantees, etc. |
41 |
|
42 |
One warning, though: pvmove is known to create problems from time to |
43 |
time. Leaking memory, bogging systems with infinite system load and so |
44 |
on. If it gives you trouble, you can abort it with `pvmove --abort` and |
45 |
try it again later by calling `pvmove volume_group` (without physical |
46 |
device specified) to resume it. It SHOULD survive system crashes. |
47 |
Trying another kernel version sometimes helps when pvmove gives you trouble. |
48 |
|
49 |
Hope this helps, |
50 |
Florian Philipp |