Skip navigation.
Reports from the fronline in IT

Starting raid 1 and LVM manually - cheat sheet

After working on a few systems were I've had to do manual start-up of the raid devices and the LVM. Here are a few of the commands that I've had to scan the man pages for.

It's a cheat sheet of the ones that you might need to get things started during a recovery.

Here are a few quick notes on some useful commands:

Look at the devices and build a mdadm.conf file

If you've got Linux Software Raid somewhere on a drive but you don't know whats there you can examine and find it.

mdadm -- examine --scan

So during manual recovery from Rescue Image I would use

mdadm --examine --scan >> /etc/mdadm.conf

to write a new mdadm.conf file based one what is on the drives in the system.

Start devices in the mdadm.conf file manually

mdadm --assemble /dev/md0
mdadm --assemble /dev/md1

Now we get the LVM to load and find devices

If you're using LVM and need to get it started manually, you need to scan the devices and then activate the Volume Group.

lvm pvscan
lvm vgdisplay

lvm vgchange -ay

Actually this is similar to what you'll see inside the initrd image if you go looking.

Here are the key lines out of the init script inside the initrd file from my Fedora laptop:

...
echo Scanning logical volumes
lvm vgscan --ignorelockingfailure
echo Activating logical volumes
lvm vgchange -ay --ignorelockingfailure  VolGroup01
...