Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to setup LVM (Logical Volume Manager) including root und
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2115
Location: Kentucky

PostPosted: Fri Apr 23, 2004 7:09 am    Post subject: gentoo 2.4.25 genkernel with root on lvm not working Reply with quote

I am installing gentoo to replace redhat, since rh is dropping support for non-"enterprise" versions at the end of April.

I use an automatic backup server to run nightly backups, so I wanted to use lvm to use the snapshot feature to improve the integrity of my backups. I also wanted to use the 2.6 series kernel and reiser4, but that uses lvm-2, and lvm-2 does not yet support snapshots under gentoo, so I had to fall back and go with the 2.4 kernel and lvm-1 to get my snapshots. That also means reiserfs version 3 instead of 4. :-(

Since I use an rsync based backup system, I backup *EVERYTHING* every night -- at least I check everything, including the root filesystem, so I wanted to be able to snapshot the root filesystem also. This means booting with a root filesystem under lvm.

I used lvmcreate_initrd to make an initial ramdisk image. I set up the grub.conf and booted. What I got was exciting -- for a few seconds -- then the kernel paniced. :x

Code:

Freeing initrd memory: 1063k freed
VFS: mounted root (ext2 filesystem) readonly.
Mounted devfs on /dev
Freeing unused kernel memory: 156k freed
can't create lock file /etc/mtab~10: Read-only filesystem (use -n flag to override)
vgscan -- ERROR "creating lvmtab" creating lvmtab
vgscan -- no voolume groups found

vgchange -- ERROR: "/etc/lvmtab" doesn't exist; please run vgscan

warning: can't open /etc/mtab: No such file or directory
umount: /proc: not mounted
kernel panic: Attempted to kill init!


I am presently running the gentoo-2.4.25 kernel from gentoo-sources built with genkernel. Does the genkernel generated kernel have lvm compiled in as part of the resident kernel, or does it use modules to install lvm?

In other words, do I need to compile a machine specific kernel to get this to work? If so, that is a pain, as I was planning to get everything working on one box, and then clone it to the other machines. My machines are heterogenous -- which means they are all different. If I have to compile a kernel for each machine, I guess I have to, but how can I compile a genkernel-like kernel, only with the necesary prerequisite support as non-modules, so I can clone to different boxes, and so if I change a hardware component in the future, I do not render the machine unusable.
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2115
Location: Kentucky

PostPosted: Sat Apr 24, 2004 5:58 am    Post subject: Reply with quote

Well, I bit the bullet and compiled a custom kernel, and IT WORKED !!!

I am now running with a small /boot partition that boots into a root-filesystem under lvm, and my swap is also on lvm, and everything is working great.

Next step is to get it running under reiserfs instead of ext3 for the root filesystem.
Back to top
View user's profile Send private message
eNTi
Veteran
Veteran


Joined: 20 Oct 2002
Posts: 1011
Location: Salzburg, Austria

PostPosted: Sat May 01, 2004 12:46 am    Post subject: Reply with quote

is this possible with udev too?
_________________
If you fall off a cliff, you might as well try to fly. After all, you got nothing to lose.

-- John Sheridan - Babylon 5, Season 4
Back to top
View user's profile Send private message
arkane
l33t
l33t


Joined: 30 Apr 2002
Posts: 918
Location: Phoenix, AZ

PostPosted: Sat May 01, 2004 2:12 am    Post subject: Reply with quote

eNTi wrote:
is this possible with udev too?


Haven't the foggiest, never used udev.
Back to top
View user's profile Send private message
arkane
l33t
l33t


Joined: 30 Apr 2002
Posts: 918
Location: Phoenix, AZ

PostPosted: Sat May 01, 2004 2:32 am    Post subject: Re: gentoo 2.4.25 genkernel with root on lvm not working Reply with quote

Moriah wrote:
I am installing gentoo to replace redhat, since rh is dropping support for non-"enterprise" versions at the end of April.


I'm in the works of setting up a full architecture at work with Gentoo, doing the same thing. Except it's replacing RH8.

Quote:

I use an automatic backup server to run nightly backups, so I wanted to use lvm to use the snapshot feature to improve the integrity of my backups. I also wanted to use the 2.6 series kernel and reiser4, but that uses lvm-2, and lvm-2 does not yet support snapshots under gentoo, so I had to fall back and go with the 2.4 kernel and lvm-1 to get my snapshots. That also means reiserfs version 3 instead of 4. :-(


We use Network Appliance to do our critical data. It does iSCSI and NFS over TCP which is really nice. I use LVM1 on a couple of servers at work, but only because they have more than one disk and I wanted to make them into a single disk... and I didn't want to go with software RAID0. I've had 3 occasions of bad experience with reiserfs just corrupting for no apparent reason, along with 2 other occasions at work where it just corrupted for no apparent reason. I've quickly gotten rid of reiserfs from the server room. I'll probably experiment with XFS later, but EXT3 has been rock solid.


Quote:

I used lvmcreate_initrd to make an initial ramdisk image. I set up the grub.conf and booted. What I got was exciting -- for a few seconds -- then the kernel paniced. :x

>snipped off code<
You know, I had the same issue way back when.
Check out this bug: https://bugs.gentoo.org/show_bug.cgi?id=7592

It might help you out.

Quote:

I am presently running the gentoo-2.4.25 kernel from gentoo-sources built with genkernel. Does the genkernel generated kernel have lvm compiled in as part of the resident kernel, or does it use modules to install lvm?


If you do it with genkernel, you should have first done the --menuconfig flag to set your options. not sure if it does by default or not, however. Myself, I'd compile it into the kernel, and not as a module. It just makes it more work if you do it with a module, and it'll be loaded at all times, anyhow.

Quote:

In other words, do I need to compile a machine specific kernel to get this to work? If so, that is a pain, as I was planning to get everything working on one box, and then clone it to the other machines. My machines are heterogenous -- which means they are all different. If I have to compile a kernel for each machine, I guess I have to, but how can I compile a genkernel-like kernel, only with the necesary prerequisite support as non-modules, so I can clone to different boxes, and so if I change a hardware component in the future, I do not render the machine unusable.


It's not going to be machine-specific. If you do i686 (pentium 3 is what I use for the processor selection) for the kernel, you can do everything x86 compat pretty much. Well, except 586 chips :)
I've used the same kernel for going on 6 machines at work so far, with a boilerplate bz2 file containing everything. Only change 2 files, and those are /etc/hosts and /etc/hostname. I woudn't wish the compilation of a new kernel for every machine on my worst enemy. You don't have to do non-modules for everything, either. You can, however, make a "stage4" that contains the kernel, filesystem, modules, and everything. I did that, and it only takes up 200mb bz2 compressed. (1.2G uncompressed) I have a central filesystem that is an rsync server, and it NFS shares pre-compiled packages. The machine doing the compiling is a dual-700, while every other machine is in the gigahertz range, and at least 1 or 2 are athlon. Thinkpad too, now that I think about it... I did my thinkpad today with Gentoo. Only took 1 1/2 hours. Pretty sweet.
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2115
Location: Kentucky

PostPosted: Sat May 01, 2004 11:30 pm    Post subject: Reply with quote

As I said earlier on another thread somewhere, I compiled a custom kernel and now have LVM on my root filesystem at boot, and swap under lvm as well. I have read too many "bad rumors" about reiserfs for me to use it in a critical application, but I did put it on a couple of workstations that are on a nightly backup schedule. We shall see how it fares...

Originally, my primary interest in reiserfs was for my backup server, since it deals with so many small files, but I will keep it under ext3 for now. If reiser4 proves reliable under the 2.6 kernel along with lvm-2 -- when snapshots work with lvm-2 under gentoo -- then I will switch the backup server over to that configuration. For now, I am running the 2.4.25 kernel with lvm-1 and reiser3 on the workstations, and ext3 in critical server applications.
Back to top
View user's profile Send private message
ColeSlaw
Apprentice
Apprentice


Joined: 19 Sep 2003
Posts: 176
Location: Kearney, NE USA

PostPosted: Mon May 03, 2004 4:19 pm    Post subject: Reply with quote

uxbod wrote:
Coming from a HP-UX SA background and do not see the point of running LVM at home. I have just build some new servers @ work using RedHat AS and the only partitions that are LVM are /oracle & /data. All system partitions are ext3. My rationale behind this is that they will be (i hope) the only two partions that shall ever need expanding. LVM is great for that.


I've got a Myth TV Box at home and LVM is great to record your shows on so that if you need more recording space you can add it easily. I definately recommend making your Myth TV drive LVM. (You never know how many MP3s or Videos you will eventually end up with.)
_________________
My Folding@home Stats!
Join the GLUE folding Team!
Back to top
View user's profile Send private message
blake121666
Tux's lil' helper
Tux's lil' helper


Joined: 21 Apr 2004
Posts: 75
Location: Catonsville, MD

PostPosted: Sat May 08, 2004 3:24 pm    Post subject: Reply with quote

eNTi wrote:
is this possible with udev too?


Yes. You need to do a

Code:
/sbin/vgscan --mknodes --ignorelockingfailure


somewhere before /etc/init.d/checkroot gets run. I put this line in /sbin/rc but I guess you could put it at the top of checkroot or probably best of all is to make an lvm bootscript to go before checkroot.
_________________
--Blake
Back to top
View user's profile Send private message
gcasillo
l33t
l33t


Joined: 23 Sep 2003
Posts: 739
Location: Cincinnati, Ohio, USA

PostPosted: Sun May 23, 2004 8:41 pm    Post subject: Reply with quote

Okay tried adding that line to /sbin/rc, but it didn't do anything. So it appears that LVM and udev do not work together at the moment. So, if you're like me, and you've been on a f'ing weekend long sojourn to build a box with Gentoo, you have been warned.

This bug report is a month old and recommends a very similar solution:

https://bugs.gentoo.org/show_bug.cgi?id=51805
Back to top
View user's profile Send private message
gcasillo
l33t
l33t


Joined: 23 Sep 2003
Posts: 739
Location: Cincinnati, Ohio, USA

PostPosted: Mon May 24, 2004 5:49 am    Post subject: Reply with quote

Nevermind. I put the wrong stuff in /etc/fstab. I put /dev/hde6 in instead of /dev/vg/var, for example. LVM2 and udev will work. Excuse me while scoop up some crow.
Back to top
View user's profile Send private message
blake121666
Tux's lil' helper
Tux's lil' helper


Joined: 21 Apr 2004
Posts: 75
Location: Catonsville, MD

PostPosted: Mon May 24, 2004 7:43 pm    Post subject: Reply with quote

Actually, I describe almost everything I did as an add-on to the person's howto of RAID-on-root at

https://forums.gentoo.org/viewtopic.php?t=8813&postdays=0&postorder=asc&start=117

I mirrored root w/LVM2 on top of the software RAID. I'm surprised it has been working so well for me. I've tested various troubleshooting scenarios that might crop up for me (like a mirror fails, lvm vg gets corrupted, ...etc) and it all appears pretty solid.

Linux has come a long way since I last fiddled with it in '95. I've setup most of my boxes with it now and am loving life! No more BSD, AIX, ...etc for me anymore. And coLinux on my XP machines is pretty cool too. Definitely ready-for-primetime stuff here.
_________________
--Blake
Back to top
View user's profile Send private message
tecknojunky
Veteran
Veteran


Joined: 19 Oct 2002
Posts: 1937
Location: Montréal

PostPosted: Sun Oct 03, 2004 5:06 am    Post subject: Reply with quote

I'm suprised and disappointed that LVM and UDEV do not play well together in Gentoo. Both have been around for awhile.

In Gentoo's udev guide, they mention
Quote:
LVM2 Names Disappear

When you use udev and LVM2 together, you might notice that your created volume groups and logical volumes have disappeared. Well, they haven't, but they are unfortunately named /dev/dm-# with # being 0, 1, ...

To fix this, edit /etc/udev/rules.d/50-udev.rules and uncomment the following line:

Code Listing 3.4: Uncomment this line from /etc/udev/rules.d/50-udev.rules

KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c"
On my system, there are no such dm-# files in /dev. So this is completely useless for me.

Thanks to Google, I found on a mailing list that I only have to issue this command...
Code:
vgchange -ay
... to see all my virtual volumes back again.

Now I need to put this somewhere useful in Gentoo. If I think hard enough and do a good job, maybe it could be used by the Gentoo bonzs?

I have a better idea :idea: Why don't you tell me where to put the command? :wink:

NEW:

I take it all back. Uncommenting the line from /etc/udev/rules.d/50-udev.rules do work and I appologies.

I just wish it would have been automatic when I upgraded to udev. I suppose that if that line is uncommented when you don't use LVM it will do strange thing? (yes. It is a question)
_________________
(7 of 9) Installing star-trek/species-8.4.7.2::talax.
Back to top
View user's profile Send private message
Xamindar
Veteran
Veteran


Joined: 03 Oct 2004
Posts: 1155
Location: California

PostPosted: Mon Oct 04, 2004 12:45 am    Post subject: Reply with quote

can someone be so kind as to tell me where the lvmcreate_initrd can be found?

On another note, I was trying to follow these tips here
https://forums.gentoo.org/viewtopic.php?t=8813&postdays=0&postorder=asc&start=117
but I get an error when I run this part:

- Make sure the library files are included
Code:

ldd bin/* | awk '{if (/=>/) { print $3 }}' | sort -u \
| awk 'system("cp "$1" lib")'
Back to top
View user's profile Send private message
blake121666
Tux's lil' helper
Tux's lil' helper


Joined: 21 Apr 2004
Posts: 75
Location: Catonsville, MD

PostPosted: Mon Oct 04, 2004 4:06 am    Post subject: Reply with quote

Xamindar wrote:
can someone be so kind as to tell me where the lvmcreate_initrd can be found?

On another note, I was trying to follow these tips here
https://forums.gentoo.org/viewtopic.php?t=8813&postdays=0&postorder=asc&start=117
but I get an error when I run this part:

- Make sure the library files are included
Code:

ldd bin/* | awk '{if (/=>/) { print $3 }}' | sort -u \
| awk 'system("cp "$1" lib")'


What error are you getting? All the commands are doing is finding the lines from the "ldd" command that list the libraries used in the binary files, uniquely listing them and copying each to the "lib" directory.
_________________
--Blake
Back to top
View user's profile Send private message
ezaekiel
n00b
n00b


Joined: 25 Aug 2005
Posts: 2

PostPosted: Fri Feb 17, 2006 10:49 am    Post subject: Re: easy Reply with quote

One wrote:
this is quite easy I think.

before you can use a partition with lvm you have to initialize this partition as a physical lvm partition ...

this is done by executing pvcreate (partition-name)

I hope this solves your problem :-)


thanks and I read it here : http://www.gentoo.org/doc/en/lvm2.xml but I don't view pvcreate :-( lol
Back to top
View user's profile Send private message
Noe
n00b
n00b


Joined: 21 Feb 2006
Posts: 9

PostPosted: Tue Feb 21, 2006 3:11 pm    Post subject: booting problem with LVM LVM Reply with quote

Hello all,

I have gone all the steps in setting up LVM2 as mentioned in http://gentoo-wiki.com/HOWTO_Install_Gentoo_on_an_LVM2_root_partition#The_Second_Easiest_Way:

- I have enabled LVM in the kernel together with device-mapper:
Code:
Device Drivers  --->
 Multi-device support (RAID and LVM)  --->
   [*] Multiple devices driver support (RAID and LVM)
   < >   RAID support
   <*>   Device mapper support

- I have compiled Device-mapper statically in to the kernel:
Code:
USE="static" emerge device-mapper

- I have enabled ramdisk and initial ramdisk support
- I have modified the lvm.conf in following way to avoid scanning all devices:
Code:
filter = [ "a|^/dev/hda[12]|", "a|^/dev/vg01$|", "r/.*/" ]

- I have edited lvm2create_initrd so as to set its size (to 8192kB) and I have created initrd with it:
Code:
sh ./lvm2create_initrd -c /etc/lvm/lvm.conf 2.6.11-gentoo-r3

- my /etc/fstab:
Code:
/dev/hda1                  /boot       ext2            noauto,noatime         1 2
/dev/hda2                  none        swap            sw                     0 0
/dev/mapper/vg01-lvol1     /           xfs             noatime                0 1
/dev/mapper/vg01-lvol2     /home       xfs             noatime                0 0
none                       /proc       proc            defaults               0 0
none                       /dev/shm    tmpfs           nodev,nosuid,noexec    0 0

- my /boot/grub/grub.conf:
Code:
title Gentoo with LVM
    kernel /boot/kernel-lvm2-2.6.11-gentoo-r3 root=/dev/ram0 lvm2root=/dev/vg01/lvol1 init=/linuxrc ramdisk=8192 video=vesafb:ywrap,mtrr,1024x768-16@85 splash=silent,theme:emergence
    initrd /boot/initrd-lvm2-2.6.11-gentoo-r3.gz


Unfortunatelly when booting, the corresponding logical volumes are not found - the system prompts with lvm2rescue but there is no command to rescue lvm2.

Could you please help?
Back to top
View user's profile Send private message
weedy
Apprentice
Apprentice


Joined: 24 Jun 2005
Posts: 247

PostPosted: Thu Mar 30, 2006 9:22 pm    Post subject: Reply with quote

When i boot i get ramdisk: incomplete write )-28 ! = 31768) 8388608 and then some can't read fs stuff. used http://gentoo-wiki.com/HOWTO_Install_Gentoo_on_an_LVM2_root_partition , http://gentoo-wiki.com/HOWTO_Gentoo_Install_on_Software_RAID_mirror_and_LVM2_on_top_of_RAID and https://forums.gentoo.org/viewtopic-t-71860-highlight-raid+mdadm.html
built the initrd with "The Second Easiest Way" (this script http://www.muncc.marmionacademy.org/~pmcdonnell/lvm2create_initrd ) with the command
./lvm2create_initrd -v -c /etc/lvm/lvm.conf -r md2 -R /etc/mdadm.conf 2.6.16-gentoo

fs compiled in, raid compiled in, lvm compiled in. I'm official out of ideas :/
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum