[RndTbl] setting up RAID 1 with mdadm
Scott Toderash
scott at 100percenthelpdesk.com
Fri Oct 5 07:09:50 CDT 2018
In my case it stayed as md0 but in theory I think it could assign
anything, as you say.
On 18-10-04 01:33 PM, Gilbert E. Detillieux wrote:
> On 04/10/2018 1:23 PM, Gilles Detillieux wrote:
>> Thanks, Scott.
>>
>> One of the steps in the tutorial is to save the MD RAID configuration
>> in /etc/mdadm/mdadm.conf. They suggest using "sudo mdadm --detail
>> --scan | sudo tee -a /etc/mdadm/mdadm.conf", which I did. In your
>> approach, that step isn't done. Is this a detail that pvcreate looks
>> after for you, either by adding to that file itself, or saving the
>> setup elsewhere?
>
> No, the LVM commands will not affect MD configuration at all. Strictly
> speaking, the mdadm.conf file (location may vary, depending on distro)
> isn't necessary. Without it, the MD arrays will still be detected and
> assembled at boot time, but you may get different device names
> assigned to them (e.g. /dev/md127, instead of /dev/md0).
>
> If you want consistent device names, it's best to have the mdadm.conf
> file. (If you're going to use UUID's or logical volume names to refer
> to your devices, then the actual assigned md device name doesn't matter.)
>
> Gilbert
>
>> This was the only part of DigitalOcean's procedure that I found to be
>> a bit kludgy. I was surprised that there wasn't something right in
>> mdadm to manage the saving of the configuration more automatically.
>> Adding the fstab entry was as I'd expect for any file system type.
>> Other than that, things were pretty plug-and-play, with no messing
>> around with systemctl or anything like that required. After a reboot,
>> the RAID array was back in action just as it should be.
>>
>> On 10/04/2018 10:07 AM, Scott Toderash wrote:
>>> Here are my notes from the last time I build a Linux RAID on LVM.
>>> This was on 16.04LTS
>>>
>>> I think my approach was slightly different. The RAID device is
>>> created on the LVM devices.
>>>
>>> 1. create partitions of type Linux RAID Autodetect on both disks
>>> fdisk -l /dev/sdb
>>> fdisk -l /dev/sdc
>>> 2. create a RAID array called md0 using mdstat
>>> sudo mdadm --create /dev/md0 --level=mirror --raid-devices=2
>>> /dev/sdb1 /dev/sdc1
>>> 3. add the md0 raid device to the LVM pool
>>> sudo pvcreate /dev/md0
>>> 4. create a volume group called datavg
>>> sudo vgcreate datavg /dev/md0
>>> 5. create a logical volume called datalv within the volume group
>>> sudo lvcreate --name datalv --size 1.8T datavg
>>> 6. format the newly created logical volume
>>> sudo mkfs.ext4 /dev/datavg/datalv
>>> 7. move home files to a temporary location, create a new home and
>>> mount the newly formatted device there, copy the original home files
>>> to the new device
>>> sudo mv home home.orig; sudo mkdir home ; sudo chmod 777 home ; sudo
>>> mount /dev/mapper/datavg-datalv /home ; sudo cp -a /home.orig/* home
>>> 8. edit fstab for startup config for this disk
More information about the Roundtable
mailing list