Automatically creating volume partitions on boot

Posted by Justin Meltzer on Server Fault See other posts from Server Fault or by Justin Meltzer
Published on 2012-10-31T22:32:41Z Indexed on 2012/10/31 23:03 UTC
Read the original article Hit count: 190

I followed this guide: http://www.mongodb.org/display/DOCS/Amazon+EC2+Quickstart to set up Mongodb.

It had me create a RAID 10 array out of the four devices on EBS. Then it had me create a physical volume, a volume group, and three logical volumes out of that RAID 10 array. Lastly it had me create ext4 filesystems out of the logical volumes and mount them.

Now the quickstart guide had me put two things in place so that these steps would be replicated on reboot of the system. It had me add some instructions to the mdadm.conf file to automatically create the RAID 10 array, and it also had me add instructions to the fstab file to automatically mount the filesystem for each logical volume.

However, the quickstart guide does not have anything for automatically creating the logical volumes from the RAID 10 array. I checked my system and see that each of the four devices are part of a RAID array:

$ sudo mdadm -Q /dev/sdh1
/dev/sdh1: is not an md array
/dev/sdh1: device 0 in 4 device unknown raid10 array.  Use mdadm --examine for more detail.

However, the filesystem is never created or mounted from fstab because it's trying to mount it from logical volumes that were never created (or so it seems).

My question is, how can I automatically accomplish all the steps from the quickstart guide on a reboot of the system, and what config file do I need to add data to so that I can automatically create these volume partions after the RAID 10 is created but before the filesystem is mounted.

Also I'm unsure whether fstab actually creates and mounts the filesystem or just mounts the filesystem.

© Server Fault or respective owner

Related posts about amazon-ec2

Related posts about lvm