LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-11-2013, 06:55 AM   #1
tripialos
Member
 
Registered: Apr 2012
Posts: 169

Rep: Reputation: Disabled
loading initrd and Kernel from LVM


Greetings

Is it possible to load the kernel and the initramfs from an LVM partition? I am doing some tests and i have setup my CentOS full with LVMs, appart from the /boot partition. In other words

/dev/sda
|
|
----/dev/sda1 --> /boot
|
|---/dev/sda2--->/dev/vg0/lvm_root --> /

I have made a fodler called "kernels" /kernels and inside that folder a i have a kernle with the initrd.

Is it possible to configure Grub to load the kernel and the initramfs from /kernels folder?

Last edited by tripialos; 08-11-2013 at 07:05 AM.
 
Old 08-11-2013, 07:38 AM   #2
goumba
Senior Member
 
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Fedora, OpenSUSE, FreeBSD, OpenBSD, macOS (hack). Past: Debian, Arch, RedHat (pre-RHEL).
Posts: 1,335
Blog Entries: 7

Rep: Reputation: 402Reputation: 402Reputation: 402Reputation: 402Reputation: 402
Is there any reason you're not using the normal /boot for kernels?

Regardless, should be able to load those kernels from where you want them. Just use the appropriate parameters (initrd, etc.). Make sure you have root set appropriately so that GRUB will know where to find the other filesystems.

Last edited by goumba; 08-11-2013 at 07:42 AM.
 
Old 08-11-2013, 07:45 AM   #3
gdejonge
Member
 
Registered: Aug 2010
Location: Netherlands
Distribution: Kubuntu, Debian, Suse, Slackware
Posts: 317

Rep: Reputation: 73
Possibly yes, grub2 has a lvm module. But as far as I know grub itself needs an ext2/3 partition to store its own stuff, like before mentioned lvm.mod.
So you still need a small /boot partition.
The question is then, why go through a lot of trouble to put the kernel on the lvm when there is a useful partition already.

Cheers
 
Old 08-11-2013, 09:27 AM   #4
goumba
Senior Member
 
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Fedora, OpenSUSE, FreeBSD, OpenBSD, macOS (hack). Past: Debian, Arch, RedHat (pre-RHEL).
Posts: 1,335
Blog Entries: 7

Rep: Reputation: 402Reputation: 402Reputation: 402Reputation: 402Reputation: 402
Quote:
Originally Posted by gdejonge View Post
Possibly yes, grub2 has a lvm module. But as far as I know grub itself needs an ext2/3 partition to store its own stuff, like before mentioned lvm.mod.
I believe this used to be the case, but is no longer true.

BTW, the OP did not post what version of GRUB. If this is GRUB Legacy (a.k.a. GRUB 1, a.k.a. GRUB 0.9.x), then no GRUB can not load a kernel from an LVM volume. I unfortunately made the assumption as well that s/he did in fact mean GRUB 2.

If it is in fact GRUB 2, see below, it may give you a start.

https://wiki.archlinux.org/index.php/GRUB#LVM

Each distrubtion has different methods for modifying the GRUB configuration. The Fedora GRUB2 wiki (https://fedoraproject.org/wiki/GRUB_2) may give you help, I couldn't find anything specific to GRUB 2 and CentOS.

Last edited by goumba; 08-11-2013 at 09:35 AM.
 
Old 08-11-2013, 09:35 AM   #5
tripialos
Member
 
Registered: Apr 2012
Posts: 169

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by goumba View Post
Is there any reason you're not using the normal /boot for kernels?

Regardless, should be able to load those kernels from where you want them. Just use the appropriate parameters (initrd, etc.). Make sure you have root set appropriately so that GRUB will know where to find the other filesystems.
I use normal boot for kernels but i am just learning about grub and how it operates. So there is this excerises that shows you have you can instruct grub to load initramfs and kernel from places other than root.

I did create another stabdard partition and completed the excerise but i was just curious how could you possibly load them from an lvm.

For instance, when i made the partition /dev/sdb2 i changed my brub config from

Code:
root (hd0,0)
to

Code:
root (hd1,1)
but how do you point root to an lvm partition?
 
Old 08-12-2013, 08:05 AM   #6
goumba
Senior Member
 
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Fedora, OpenSUSE, FreeBSD, OpenBSD, macOS (hack). Past: Debian, Arch, RedHat (pre-RHEL).
Posts: 1,335
Blog Entries: 7

Rep: Reputation: 402Reputation: 402Reputation: 402Reputation: 402Reputation: 402
See my post above yours, I had posted at the same time. What version of GRUB are we talking about, 1 or 2? With GRUB 1 it is *not* possible to load a kernel image from LVM, with GRUB 2 it is.
 
1 members found this post helpful.
Old 08-30-2013, 03:33 AM   #7
tripialos
Member
 
Registered: Apr 2012
Posts: 169

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by goumba View Post
See my post above yours, I had posted at the same time. What version of GRUB are we talking about, 1 or 2? With GRUB 1 it is *not* possible to load a kernel image from LVM, with GRUB 2 it is.
Hi Goumba

Yes i use Grub2 . Thnaks for the information.

I am not planning to use any lvm partiotionas as boot and my question was pure quriocity.

Thnaks for the info again
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
boot from lvm without initrd pgb205 Red Hat 1 03-01-2009 03:57 PM
initrd for LVM no longer works Dietrich Linux - General 1 04-21-2007 09:53 AM
Encrypted LVM needs a initrd Zmyrgel Slackware 3 09-10-2006 09:46 AM
creating initrd to boot from LVM jcai Linux - General 3 06-12-2006 01:04 PM
process of loading initrd kallis_john Linux - General 0 11-15-2004 03:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration