From mboxrd@z Thu Jan 1 00:00:00 1970 From: myglc2 Subject: Re: [PATCH} Add RAID devices. Date: Sat, 30 Jul 2016 19:05:25 -0400 Message-ID: <86k2g2pw0a.fsf@gmail.com> References: <20160714131306.GA11566@solar> <20160723140701.GB6873@solar> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58699) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTdLj-00077Z-Mi for guix-devel@gnu.org; Sat, 30 Jul 2016 19:07:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bTdLf-0000iR-GG for guix-devel@gnu.org; Sat, 30 Jul 2016 19:07:18 -0400 Received: from blaine.gmane.org ([80.91.229.8]:57578) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTdLf-0000iK-62 for guix-devel@gnu.org; Sat, 30 Jul 2016 19:07:15 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1bTdLY-0006xE-3e for guix-devel@gnu.org; Sun, 31 Jul 2016 01:07:08 +0200 List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org --=-=-= Content-Type: text/plain Andreas Enge writes: > the attached patch adds RAID support to our mapped device mechanism. > > To give more explanation: > Like for LUKS devices or file systems, the RAID itself needs to be created > during installation, after booting from the USB key: > mdadm --create /dev/md0 --level=raid10 --layout=f2 \ > --raid-devices=2 /dev/sda2 /dev/sdb2 > (wait 12 hours or so for 4 TB disks) > mkfs.ext4 /dev/md0 > > Then one adds a mapped-device of type raid-device-mapping, adds the > raid10 kernel module to the initrd and can boot from the RAID device. > The mapped-device mechanism calls "mdadm --assemble" and "mdadm --stop". > > I might write a more detailed blog post about this; there is a little > subtlety with the non-automatic determination of dependencies between > devices, so one needs to make sure that the partitions to be assembled > are present before the mdadm command is executed. Thanks. Starting with baby steps, I am running GuixSD system from a separate drive and adding raid1 array with 2 new disks. I created an array that will assemble like so... g1@g1 ~$ sudo mdadm --assemble /dev/md0 /dev/sdb1 /dev/sdc1 mdadm: /dev/md0 has been started with 2 drives. g1@g1 ~$ cat /proc/mdstat Personalities : [raid1] md0 : active raid1 sdc1[0] sdb1[1] 239809536 blocks super 1.2 [2/2] [UU] bitmap: 0/2 pages [0KB], 65536KB chunk I added this to my config (system25.scm attached) ... (operating-system [...] (initrd (lambda (fs . args) (apply base-initrd fs #:extra-modules '("raid1") #:mapped-devices '((mapped-device (source (list "/dev/sdb1" "/dev/sdc1")) (target "/dev/md0") (type raid-device-mapping))) args))) [...] I rebooted and the array is not assembled ;-( g1@g1 ~$ cat /proc/mdstat Personalities : [raid1] unused devices: /var/log/messages contains ... [...] Jul 30 18:09:59 localhost vmunix: [ 1.872801] md: raid1 personality registered for level 1 [...] Any suggestions, corrections or a sample working config would be most welcome. TIA - George --=-=-= Content-Type: application/octet-stream Content-Disposition: attachment; filename=system25.scm Content-Transfer-Encoding: base64 Ozs7IGcxIHN5c3RlbSBjb25maWcKKHVzZS1tb2R1bGVzIChnbnUpKQoodXNlLXNlcnZpY2UtbW9k dWxlcyBuZXR3b3JraW5nIHNzaCkKKHVzZS1wYWNrYWdlLW1vZHVsZXMKIGJhc2UKIGFkbWluCiBk aXNrCiBsaW51eCAgICAgICAgICAgICAgICAgOyBtZGFkbQogcGFja2FnZS1tYW5hZ2VtZW50ICAg IDsgZ3VpeAogc2NyZWVuCiBnaG9zdHNjcmlwdCAgICAgICAgICAgOyBncy1mb250cwogZm9udHMg ICAgICAgICAgICAgICAgIDsgZm9udC1kZWphdnUgZm9udC1nbnUtZnJlZWZvbnQtdHRmCiBjdXJs ICAgICAgICAgICAgICAgICAgOyBscGFzdGUKIHNzaAogeG9yZyBjZXJ0cwogcnN5bmMKIHdnZXQK IH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