LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   RHEL 5 system lost file system info, stuck on GRUB (https://www.linuxquestions.org/questions/linux-server-73/rhel-5-system-lost-file-system-info-stuck-on-grub-4175444674/)

johnToledo 01-08-2013 10:52 AM

RHEL 5 system lost file system info, stuck on GRUB
 
Hello!

I have a virtualized RHEL server 5 inside a windows 2008 R2 machine.
Recently someone disconnected the VM without shuting it down first :doh:
Now, the system got stuck in the grub prompt.

So, when I try to configure grub manually I get this:
Code:

grub> root (hd0,<TAB>
 Possible partitions are:
    Partition num: 0, Filesystem type unknown, partition type 0x83
    Partition num: 1, Filesystem type unknown, partition type 0x8e
    Partition num: 2, Filesystem type unknown, partition type 0x83

So even if I complete the command, grub can't mount the filesystem because it doesn't know the type (Part 0 is ext3, 1 is swap, and 2 ext3 also)

So, enter linux rescue.
With the media inserted y go to linux rescue and it succesfully mount the filesystem in /mnt/sysimage so I chroot /mnt/sysimage, start some services and voila, the system is up and running as always.

When i try to reinstall grub i get the following:
Code:

# grub-install /dev/hda
/dev/hda does not have any corresponding BIOS drive.

parted output:
Code:

(parted) print /dev/hda

Model: Virtual HD (ide)
Disk /dev/hda: 53.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start  End    Size    Type    File system  Flags
 1      32.3kB  107MB  107MB  primary              boot
 2      107MB  10.7GB  10.6GB  primary              lvm
 3      10.7GB  53.7GB  42.9GB  primary

Also I've noticed that /boot/grub/grub.conf does not exist. But I've created one based on another RHEL system with the same configuration and nothing happens.

I've spend 2 days trying to fix this, so I give up.

Thanks in advance!

unSpawn 01-08-2013 12:38 PM

Quote:

Originally Posted by johnToledo (Post 4865479)
When i try to reinstall grub i get the following:
Code:

# grub-install /dev/hda
/dev/hda does not have any corresponding BIOS drive.

(..) Also I've noticed that /boot/grub/grub.conf does not exist.

Before you 'grub-install /dev/hda --recheck' first ensure /boot/grub/ contents remain unaltered, having all the requires stage.*, map, device and whateverelse files?

johnToledo 01-08-2013 01:01 PM

Ok,
the contents of my /boot/grub directory is as follows:
Code:

-rw-r--r-- 1 root root    30 Jan  8 11:36 device.map
-rw-r--r-- 1 root root  7584 Jan  8 11:36 e2fs_stage1_5
-rw-r--r-- 1 root root  7456 Jan  8 11:36 fat_stage1_5
-rw-r--r-- 1 root root  6720 Jan  8 11:36 ffs_stage1_5
-rw-r--r-- 1 root root  1101 Jan  8 11:36 grub.conf
-rw-r--r-- 1 root root  6720 Jan  8 11:36 iso9660_stage1_5
-rw-r--r-- 1 root root  8224 Jan  8 11:36 jfs_stage1_5
-rw-r--r-- 1 root root  6880 Jan  8 11:36 minix_stage1_5
-rw-r--r-- 1 root root  9248 Jan  8 11:36 reiserfs_stage1_5
-rw-r--r-- 1 root root    512 Jan  8 11:36 stage1
-rw-r--r-- 1 root root 104988 Jan  8 11:36 stage2
-rw-r--r-- 1 root root  7072 Jan  8 11:36 ufs2_stage1_5
-rw-r--r-- 1 root root  6272 Jan  8 11:36 vstafs_stage1_5
-rw-r--r-- 1 root root  8872 Jan  8 11:36 xfs_stage1_5

I assume it has all the stages and files that needs. Or maybe not?

Then, running grub-install again:
Code:

# grub-install /dev/hda --recheck
Probing devices to guess BIOS drives. This may take a long time.
/dev/mapper/VolGroup00-LogVol00 does not have any corresponding BIOS drive.


syg00 01-08-2013 03:00 PM

Might be damage to (the start of) the container disk file on the host - everything is virtualised, including the MBR, and the "BIOS" boot sequence. As you can chroot into the system o.k., I'd get your data backed up and just stand up another guest and migrate over to that. Simplest way to ensure you have a clean environment to work with.

johnToledo 01-09-2013 06:58 AM

Thank you syg00. I was thinking the same thing as a plan B.
Its going to take some time to re-building the entire enviroment again, that's why I want it to try to recover from this error.
I'm gonna give it one last try and if it doesn't work, we're gonna build another guest.

unSpawn 01-09-2013 07:24 AM

Quote:

Originally Posted by johnToledo (Post 4865567)
I assume it has all the stages and files that needs. Or maybe not?

Well, you know what they say about assuming ;-p Since /boot/grub/ contents consist of mostly /usr/share/grub/*/ you could:
Code:

rpm -Vv grub|grep -v '^\.\{8\}[[:blank:]]'
md5sum /usr/share/grub/*/* /boot/grub/* | sort -g | uniq -w32 -d --all-repeated=separate



Quote:

Originally Posted by johnToledo (Post 4865567)
Code:

# grub-install /dev/hda --recheck
Probing devices to guess BIOS drives. This may take a long time.
/dev/mapper/VolGroup00-LogVol00 does not have any corresponding BIOS drive.


IIRC this has something to do with GRUB not recognizing LVM volumes and leaving them be. I don't have a fix for it at hand but it looks like something that can be worked around. Some posts I've read suggest ensuring all mount points, all LVs mounted when "/" is active, be mounted at their proper location inside /mnt/sysimage before running grub-install.

johnToledo 01-09-2013 08:06 AM

Quote:

Originally Posted by unSpawn (Post 4866073)
Code:

rpm -Vv grub|grep -v '^\.\{8\}[[:blank:]]'
md5sum /usr/share/grub/*/* /boot/grub/* | sort -g | uniq -w32 -d --all-repeated=separate


They are identical.:hattip:

I will try to mount manually all the LVs inside /mnt/sysimage and run grub-install


All times are GMT -5. The time now is 11:33 AM.