[CentOS] "Can't find root device" with lvm root after moving drive on CentOS 6.3

Sat Mar 23 03:27:27 UTC 2013
Joakim Ziegler <joakim at terminalmx.com>

I have an 8-core SuperMicro Xeon server with CentOS 6.3. The OS is 
installed on a 120 GB SSD connected by SATA, the machine also contains 
an Areca SAS controller with 24 drives connected. The motherboard is a 
SuperMicro X9DA7.

When I installed the OS, I used the default options, which creates an 
LVM volume group to contain / and /home, and keeps /boot and /boot/efi 
outside the volume group.

The machine is a couple of months old, and has been stable. While 
installing some new hardware, I decided to also clean up the cabling in 
the box, since it was a bit messy. In doing this, I probably moved the 
boot SSD disk to another port on the motherboard (it has a bunch, 2 SATA 
6GBps and 6 SATA 3GBps).

When I booted the box after this, I got a kernel panic, the typical 
"Can't find root device".

I read some docs, and first tried to boot from a rescue disc and 
reinstal GRUB, but that didn't change anything. Further Googling got me 
the rdshell kernel parameter, and that dropped me to a shell when it 
failed to find the root device.

Reading https://fedoraproject.org/wiki/How_to_debug_Dracut_problems , I 
did the following:

# lvm vgscan
# lvm vgchange -ay

And then

# ln -s /dev/mapper/<volumegroup>-<root_volume> /dev/root
# exit

After this, the box boots up normally, and everything works as it 
should. However, when I reboot, it again fails to find the root device.

So, after all this, my question is, how do I make Dracut (I'm assuming) 
understand that this LVM volume is my root device and pick it up 
automatically?

And, is there a way to avoid this problem in the future, if I move 
drives around? Surely it can't be normal for this to happen just because 
I connect a drive to another port?

-- 
Joakim Ziegler  -  Supervisor de postproducción  -  Terminal
joakim at terminalmx.com   -   044 55 2971 8514   -   5264 0864