[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Where do I find the definitive man page for mdadm?



On Fri, 12 Nov 2021 08:05:53 -0500
Gene Heskett <gheskett@shentel.net> wrote:

> The man page we have goes on and on for megabytes without ever giving
> an example.
> 
> I thought maybe it could scan for devices so that I could build an 
> mdadm.conf but it wont do a --scan by itself.

Nope, near as I can figure --scan only works with an existing RAID
setup. You have to create it first. And you have to create it manually.
mdadm is not going to guess.

Not that I am any kind or RAID expert, but I did create a RAID1
installation about a year ago. I recently added a drive and moved from
RAID1 to RAID5.

In the interest of protecting my data should I ever have to install one
of these drives somewhere else, I first created a partition on each
of the two new drives. Then:

mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdc1 /dev/sdd1

I then set up encryption in the RAID device:

cryptsetup -y -v luksFormat /dev/md0
cryptsetup luksOpen /dev/md0 encryptedRaid
cryptsetup -v status encryptedRaid
cryptsetup luksDump /dev/md0

Preserve the header, just in case....
cryptsetup luksHeaderBackup /dev/md0 --header-backup-file ${HOSTNAME}.$(date +%Y.%m.%d).luks.raid.backup

Then build the LVM on top of /dev/mapper/encryptedRaid:

pvcreate /dev/mapper/encryptedRaid	# create the physical volume.
vgcreate hawk-vg-raid /dev/mapper/encryptedRaid	# Create the volume group.
lvcreate -n crc$( date +%Y ) -L 2862612M hawk-vg-raid	# Create a logical volume

etc. The RAID5 setup is working just fine.

Note: The RAID volume is open for business as soon as you create it.
But it will then take several hours to sync between the two drives.
Same thing when I expanded from RAID1 to RAID5; it took more than a day
of steady thrashing.

Hope that helps.

-- 
Does anybody read signatures any more?

https://charlescurley.com
https://charlescurley.com/blog/


Reply to: