PDA

View Full Version : [ubuntu] 10.04 2 LVM Server Install Grub Issue



zelgaddiss
June 9th, 2011, 10:38 PM
So I installed Ubuntu Server 10.04 2 on an LVM. I've seen things go wrong if the /boot mount point is on the LVM so I left a partition out of the lvm formatted with EXT3.
My setup is this
sda (500Gb) - (5gb /boot ext3 partition) (LVM)
sdb (1Tb) - (LVM)
sdb (1Tb) - (LVM)

VG:
swap (3gb)
root (2.5Tb) mounted on / formatted EXT3

I keep getting an error when booting that grub can't find pv2 then the screen just goes black. After doing some searches on google and here for how to get GRUB working on an LVM none of the results have been good. I made sure to keep the /boot mount out of the LVM as to not need to have LVM support in grub, i think is what people had said.

Any help would be greatly appreciated.
Thank you!

YesWeCan
June 9th, 2011, 11:49 PM
Hi there. I'm not sure what you are trying to do. Grub2 can boot an LVM no problem. You can have a separate /boot partition if you want.
What version of Grub are you using?

Let's also take a look at /etc/fstab and sudo fdisk -l and sudo blkid (boot a live CD and install LVM first).

zelgaddiss
June 9th, 2011, 11:55 PM
Hi there. I'm not sure what you are trying to do. Grub2 can boot an LVM no problem. You can have a separate /boot partition if you want.
What version of Grub are you using?

Let's also take a look at /etc/fstab and sudo fdisk -l and sudo blkid (boot a live CD and install LVM first).

Grub Version 0.97

Fstab:
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
/dev/mapper/met--cs-root / ext3 errors=remount-ro 0 1
# /boot was on /dev/sda1 during installation
UUID=8b32d81b-e1dd-4394-9d02-657f4b0f6b26 /boot ext3 defaults 0 2
/dev/mapper/met--cs-swap none swap sw 0 0

blkid:
/dev/loop0: TYPE="squashfs"
/dev/sda1: UUID="8b32d81b-e1dd-4394-9d02-657f4b0f6b26" TYPE="ext3"
/dev/sda5: UUID="rNYF30-0xyU-WEkv-R1J5-2I7X-PbZh-UlwAz1" TYPE="LVM2_member"
/dev/sdb1: UUID="fcF48j-E7O4-xB0H-F1CJ-NQaI-Ahp8-eptmRy" TYPE="LVM2_member"
/dev/sdc1: UUID="HTnbzz-6YiM-s4B2-62Dn-EFvd-2hxW-Xh2Poq" TYPE="LVM2_member"
/dev/mapper/met--cs-swap: UUID="fd0f0752-ccc0-49da-9342-be8eba25ba17" TYPE="swap"
/dev/mapper/met--cs-root: UUID="0abe045f-8c26-4ece-a288-94a203dc90ff" TYPE="ext3"


my issue is that grub just does not boot, not sure what is going on.

YesWeCan
June 10th, 2011, 12:15 AM
You are using "Grub legacy" which I am not very au fait with. Someone else may be able to assist. Otherwise you could upgrade the system to Grub2 and try again. https://help.ubuntu.com/community/Grub2

zelgaddiss
June 10th, 2011, 12:27 AM
You are using "Grub legacy" which I am not very au fait with. Someone else may be able to assist. Otherwise you could upgrade the system to Grub2 and try again. https://help.ubuntu.com/community/Grub2

Ok so here's what I did, got the new version 1.98, then
apt-get install lvm2
modprobe dm-mod
vgchange -a y
mount /dev/met-cs/root /mnt
mount /dev/sda1 /mnt/boot/ (sda1 is my /boot partition)
mount /usr /mnt/usr (for grub2)
chmod /mnt
grub-install /dev/sda
grub-install --recheck /dev/sda

then rebooted and still nothing.

YesWeCan
June 10th, 2011, 12:32 AM
Ok, it may be that because your /boot is in a different partition to / you need to inform grub-install about this.
Something like: grub-install --boot-directory=/dev/sda1 /dev/sda.

And, of course, your /boot partition needs to be symbolically linked to /boot in root.

You may also want to do an update-grub for good measure.

zelgaddiss
June 10th, 2011, 12:36 AM
Ok, it may be that because your /boot is in a different partition to / you need to inform grub-install about this.
Something like: grub-install --boot-directory=/dev/sda1 /dev/sda.

And, of course, your /boot partition needs to be symbolically linked to /boot in root.

Ok so:
(do my mounts)
ln /boot /<place I mount dev/sda1>/
chroot /mnt
grub-install --boot-directory=/dev/sda1 /dev/sda

I think i'm getting this more and more, but just want to make sure

YesWeCan
June 10th, 2011, 12:41 AM
Sorry I am getting confused. I don't do chroots often. I suspect you just need to mount the boot partition at /boot. So that the OS uses /dev/sda1 instead of its local /boot. Otherwise update-grub won't work. This mount may not be strictly necessary. The important thing is to repeat the grub-install specifying the boot partition. Hopefully, what you already have in it is fine.

There are detailed instructions in that Community Grub2 page.

[edit]
Ok, it's getting late here. ;) You don't need to use the /boot partition at all.
What I would do is chroot into the OS. Remove the boot partition mount from fstab. Make sure you /boot is the one in root. Run update-grub to set all the files up in /boot. Then do the grub-install /dev/sda then reboot.

Make sure you follow the web instructions correctly for doing a chroot.

If this boots you can delete the boot partition.

[edit2] I think I'll have to come back to you in the morning!
All your boot files are probably in your sda1 partition. So you need to copy them into the /boot in the root partition first. Then you can do update-grub and then grub-install.

YesWeCan
June 10th, 2011, 12:53 PM
Ok so here's what I did, got the new version 1.98, then
apt-get install lvm2
modprobe dm-mod
vgchange -a y
mount /dev/met-cs/root /mnt
mount /dev/sda1 /mnt/boot/ (sda1 is my /boot partition)
mount /usr /mnt/usr (for grub2)
for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt$i; done
chroot /mnt
update-grub
grub-install --root-directory=/dev/sda1 /dev/sda
grub-install --recheck /dev/sda

then rebooted and still nothing.

Ok. I've added things in red, all from https://help.ubuntu.com/community/Grub2#Reinstalling%20GRUB%202. I need to know what exactly happens when it doesn't work.

-------------------

When in doubt, simplify!
With Grub2 there is no need for a separate partition for boot, so why complicate things? To stop using it:
copy cp -ar all your sda1 files to /boot.
remove the fstab entry that mounts sda1
Then either
do the chroot procedure again without mounting sda1 and run update-grub and grub-install /dev/sda.
or
From a live CD running the same version of Grub2 and running LVM, mount the root partition at /mnt and then do 'sudo grub-install --root-directory=/mnt /dev/sda'

zelgaddiss
June 10th, 2011, 07:10 PM
Humm, this is weird.
Because this is a new install I went though and re-installed 10.04 from the alt CD and just made the / and swap mount points on the LVM now when it boots from default (grub 1.98 ) it just comes up to 'Error: Physical Volume pv2 not found' when I ls I could see (metcs-root) but when I type 'ls (metcs-root)/' it says the same thing.

robertmf
May 29th, 2012, 03:16 PM
You can't boot from a lvm partition.