1

If I have my root device is a LVM logical volume, how can I figure out the path via the Grub CLI without access to the original grub.conf file?

This is for use in the kernel command's root and rd_LVM_LV parameters. E.g.:

kernel /vmlinuz-2.6.34.8-68.fc13.i686.PAE ro root=/dev/mapper/vg_sever1-root rd_LVM_LV=vg_server1/root

Normally, you could tab in the CLI to get hints as far as file location, available HDs, etc.. However, I am not sure how to obtain the volume group's name or the root logical volume.

Belmin Fernandez
  • 10,629
  • 26
  • 84
  • 145
  • 1
    If it is an option, boot from a decent Live CD like [grml](http://grml.org) to find out details about the LVM configuration. Then adjust the Grub configuration on the fly or maybe fix it from within the Live CD. – daff Jul 24 '11 at 23:13
  • Thanks daff. Was hoping to find a solution that did not involve a Live CD. However, it could very well be the only way. – Belmin Fernandez Jul 24 '11 at 23:18

1 Answers1

3

grub has a cat command, so you can look at grub.conf from the prompt:

grub> root (hd0,0)
 Filesystem type is ext2fs, partition type 0x83

grub> cat /grub/grub.conf
#splashimage=(hd0,0)/grub/splashimage.xpm.gz
timeout 30
[...]

This may not help if the drive you're working on no longer has the grub.conf file, but even if it's not bootable the file is still accessible.

Handyman5
  • 5,177
  • 25
  • 30
  • I was hoping to find a solution when you *no longer* have access to the `grub.conf` file for whatever reason. Based on my research, seems that there is no way to figure out if partition is a PV for an LVM just from the grub shell. I was hoping someone could enlighten me :-) – Belmin Fernandez Jul 25 '11 at 12:01
  • Well, if you try to run `root (hdX,X)` within grub, it should tell you the filesystem type, which will be different for LVM than it is for standard partitions, so you can _detect_ an LVM physical volume that way. However, that doesn't help with any of the rest of the LVM layers. – Handyman5 Jul 25 '11 at 13:08
  • Noticed that during the boot process, right before it attempts to mount the root volume, there's a printed list of the LVM LV's that were auto-detected. This might be sufficient information for a trial-and-error process. Not the preferable way to go about it but could be effective nonetheless. – Belmin Fernandez Jul 25 '11 at 14:08