LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   grub-install cannot find device VolGroup on a ext4 partition (https://www.linuxquestions.org/questions/linux-newbie-8/grub-install-cannot-find-device-volgroup-on-a-ext4-partition-925739/)

superolmo 01-25-2012 11:41 PM

grub-install cannot find device VolGroup on a ext4 partition
 
I have a VMwave image with CentOS 5.7 installed. The first partition (/dev/sda1) was /boot and the second was a logical volume (/dev/sda2). I have decided to remove the logical volume and combine the 2 partitions.
I setup a new VMware hard drive and formatted as a single partition (/dev/sdb1). Next I booted Ubuntu live CD and mounted the new partition and the partitions with the logical volume and then the boot partition inside as follows:
Code:

mount /dev/sda2 /media/hd1
mount /dev/sda1 /media/hd1/boot
mount /dev/sdb1 /media/hd2

I copied all files from hd1 to hd2 using:
Code:

cp -avf /media/hd1/* /media/hd2
Next I connected the dev and proc directories to the new partition:
Code:

mount --bind /dev /media/hd2/dev
mount --bind /proc /media/hd2/proc

I run
Code:

grub-install --recheck /dev/sdb
but it gives me an error.

At this point I thought it should be almost done, I just need to reinstall grub, but grub-install tells me that
Code:

could not find device for /dev/mapper/VolGroup00-LogVol00
could not find device for /dev/mapper/VolGroup00-LogVol00
could not find device for /dev/mapper/VolGroup00-LogVol00
/dev/mapper/VolGroup00-LogVol00: Not found or not a block device.

What am I doing wrong?

I changed Ubuntu Live CD to CentOS 5.7 dvd in rescue mode, but it is doing the same thing.

The reason for removing the logical volume in the VMware is to reduce the virtual disk space and remove the more complicated to manage (for me) logical volume.

towheedm 01-26-2012 09:31 PM

Try running grub-install from a chroot environment.
Code:

chroot /media/hd2 grub-install --recheck /dev/sda
If you still get the error, edit /media/hd2/boot/grub/device.map:
Code:

hd0  /dev/sda
and run grub-install from the chroot environment:
Code:

chroot /media/hd2 grub-install /dev/sda
Hope it helps.

superolmo 01-27-2012 08:11 PM

Yes, I forgot to mention that I did use
Code:

chroot /media/hd2
I checked the device.map and I made sure that it contains the entry
Code:

hd0  /dev/sda
but still I get the same error.

I think I got little further by binding also the sys directory
Code:

mount --bind /sys /media/hd2/sys
I rebuild the mtab file using
Code:

grep -v rootfs /proc/mounts > /etc/mtab
Now, grub-install gives me:
Code:

df: cannot read table of mounted file systems
Thanks though, I am going to restart from scratch since I have the original VMware drive.


All times are GMT -5. The time now is 12:55 AM.