Gentoo Archives: gentoo-user

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

Attachments

File name MIME type
signature.asc application/pgp-signature