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

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



On Friday 12 November 2021 08:39:31 Charles Curley wrote:

> 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

Thats what I've been looking for, a commandline example I can modify for 
my use. Since posting, I have found that gparted spits out a list of 
disks that have never been labeled, and those then are the disks I'll 
want to use.
So

mdadm --create --verbose /dem/md0 --level=10 --raid-devices=4 /dev/sde /dev/sdf /dev/sdg /dev/sdh

should work.

but once assembled, does it need formatted? I don't intend to encrypt.

> 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.
A bunch, thanks.

Cheers, Gene Heskett.
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/gene>


Reply to: