From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Q4puC-0004La-Ef for garchives@archives.gentoo.org; Wed, 30 Mar 2011 07:33:28 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6A5301C05F; Wed, 30 Mar 2011 07:31:45 +0000 (UTC) Received: from smtpq3.gn.mail.iss.as9143.net (smtpq3.gn.mail.iss.as9143.net [212.54.34.166]) by pigeon.gentoo.org (Postfix) with ESMTP id 12B111C05F for ; Wed, 30 Mar 2011 07:31:44 +0000 (UTC) Received: from [212.54.34.136] (helo=smtp5.gn.mail.iss.as9143.net) by smtpq3.gn.mail.iss.as9143.net with esmtp (Exim 4.71) (envelope-from ) id 1Q4psW-0003ow-C7 for gentoo-user@lists.gentoo.org; Wed, 30 Mar 2011 09:31:44 +0200 Received: from 5353c7ed.cm-6-4d.dynamic.ziggo.nl ([83.83.199.237] helo=data.antarean.org) by smtp5.gn.mail.iss.as9143.net with esmtp (Exim 4.71) (envelope-from ) id 1Q4psV-0003KX-Ka for gentoo-user@lists.gentoo.org; Wed, 30 Mar 2011 09:31:43 +0200 Received: from localhost (localhost [127.0.0.1]) by data.antarean.org (Postfix) with ESMTP id BA9B22A12 for ; Wed, 30 Mar 2011 09:32:58 +0200 (CEST) X-Virus-Scanned: amavisd-new at antarean.org Received: from data.antarean.org ([127.0.0.1]) by localhost (data.antarean.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cD8HOz0VsF5R for ; Wed, 30 Mar 2011 09:32:58 +0200 (CEST) Received: from eve.localnet (eve.lan.antarean.org [10.20.13.50]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by data.antarean.org (Postfix) with ESMTPS id 782AD1085 for ; Wed, 30 Mar 2011 09:32:58 +0200 (CEST) From: Joost Roeleveld To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] How to change from one harddrive to software raid Date: Wed, 30 Mar 2011 09:31:42 +0200 User-Agent: KMail/4.6 beta4 (Linux/2.6.36-gentoo-r5; KDE/4.6.1; x86_64; ; ) In-Reply-To: <4D92BF88.6000807@binarywings.net> References: <4D92BF88.6000807@binarywings.net> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Message-Id: <20110330073258.BA9B22A12@data.antarean.org> X-ZiggoSMTP-MailScanner-Information: Please contact the ISP for more information X-ZiggoSMTP-MailScanner-ID: 1Q4psV-0003KX-Ka X-ZiggoSMTP-MailScanner: Found to be clean X-ZiggoSMTP-MailScanner-SpamCheck: geen spam, SpamAssassin (niet cached, score=-0.928, vereist 5, BAYES_00 -1.90, RDNS_DYNAMIC 0.98, T_RP_MATCHES_RCVD -0.01) X-ZiggoSMTP-MailScanner-From: joost@antarean.org X-Spam-Status: No X-Archives-Salt: X-Archives-Hash: 9839e3b0dc58ec729349be9fa061675a On Wednesday 30 March 2011 07:28:40 Florian Philipp wrote: > Am 30.03.2011 05:02, schrieb Einux: > > Hi, > > > > I bought a new 1T harddrive which is exactly the same as my previous > > harddrive. So I'm planning to make a Raid-1 layout(for security > > reasons). But here's the problem: I've already setup LVM2 on the > > existing harddrive and I don't want to destroy the existing LVM volume > > groups. I tried to google it, but I'm not sure which is the right > > keyword. Could you guys help me out? > > > > Thanks in advance:) > > 1. Create a degenerated RAID1 with your new disk > mdadm --create /dev/md0 --level=1 --raid-devices=2 missing /dev/sdb > > 2. Partition the raid device > > 3. Add one of the partitions to your LVM volume group. > pvcreate /dev/sdb2 > vgextend volume_group /dev/sdb2 > > 4. Move everything from the old physical volumes to the new pv. > pvmove /dev/sda3 /dev/sdb2 > > 5. Remove the old and now empty physical volume > vgreduce volume_group /dev/sda3 > > 6. Move everything else which is not on LVM to your new raid. Guess you > need to go to single user mode to do this safely. > > 7. Grow your raid to also contain the old disk. > mdadm /dev/md0 -a /dev/sda > > No, I have not tested this and you should double-check everything. No > guarantees, etc. > > One warning, though: pvmove is known to create problems from time to > time. Leaking memory, bogging systems with infinite system load and so > on. If it gives you trouble, you can abort it with `pvmove --abort` and > try it again later by calling `pvmove volume_group` (without physical > device specified) to resume it. It SHOULD survive system crashes. > Trying another kernel version sometimes helps when pvmove gives you trouble. To avoid that, with "large" moves, do the following: # pvmove -i 600 /dev/sda3 The "-i 600" means, only report every 10 minutes. It's the "reporting" that causes the memory leak. Also, when just wanting to "empty" one physical volume, it is not necessary to specify the "target". It's a good idea to mark the PVs on the existing drive "non-allocatable". Then LVM won't try to move anything to that PV: # pvchange -xn /dev/sda3 The rest of the steps read correct. It's how I did a similar operation, but still double-check all the parameters and when in doubt, read the manual and/or ask on the list. -- Joost Roeleveld