How to best use LVM?
Hi all,
I'm new to both this list and to LVM in general. As such, I have some questions I'm hoping someone can help me answer.
I understand the benefits of LVM, but have never used LVM in any incarnation, on Linux or any other version of UNIX. I am, however, pretty well versed in RAID. So, I'm wondering how LVM can also provide the varied benefits of RAID.
- Can I use it to extend a RAID 5 set,
or concatenate 2 RAID 5 sets together?
- Can I use LVM to combine different types of RAID, such as 1 and 0?
- Can I easily "grow" a RAID set using LVM?
The other question I had more directly relates to the Linux implementation for LVM:
- Which version do I use?
I'm currently using Debian/Sid w/ a non-modular, custom 2.4.18 kernel. apt-cache shows 2 versions; lvm10 and lvm2.
Is lvm10 the 1.x series and lvm2 the 2.x? Or does lvm10 come after lvm2?
If the former, is 2.x stable enough to use, and is it better to compile lvm from source or use the pre-compiled debian packages?
I've tried both the lvm10 and lvm2 packages, but continually recieve errors when I do things like run lvdisplay (it complains about not being able to flush the device several times), and also something about not being able to open the device-mapper.
I'm very much looking forward to using LVM, and hope someone here can help me get started. Thanks!
Signature · 7 lines
Seeya, Paul -- It may look like I'm just sitting here doing nothing, but I'm really actively waiting for all my problems to go away. If you're not having fun, you're not doing it right!
Quoted 1 line · On Wed, Aug 14, 2002 at 12:59:38PM -0400, [email protected] wrote:
Is lvm10 the 1.x series and lvm2 the 2.x?
Yes, lvm2 is a totally new kernel driver and userland tools.
Quoted 1 line
If the former, is 2.x stable enough to use
Yes.
Quoted 2 lines
and is it better to
compile lvm from source or use the pre-compiled debian packages?
The debian packages should be ok.
Quoted 4 lines
I've tried both the lvm10 and lvm2 packages, but continually recieve errors when I do things like run lvdisplay (it complains about not being able to flush the device several times), and also something about not being able to open the device-mapper.
device-mapper is the kernel driver used by LVM2, there should be a debian package for this too.
- Joe
In a message dated: Wed, 14 Aug 2002 18:45:47 BST
Quoted 2 lines · Joe Thornber
device-mapper is the kernel driver used by LVM2, there should be a debian package for this too.
I've tried that, and even installing the device-mapper from sources.
For some reason the devmap_mknod.sh script is unable to create the /dev/device_mapper/control file. It appears that the problem is an inability to find the minor number from /proc/misc, which happens to be empty.
Did I forget to configure something in my kernel which should be appearing in my /proc/misc file?
Thanks,
Signature · 7 lines
Seeya, Paul -- It may look like I'm just sitting here doing nothing, but I'm really actively waiting for all my problems to go away. If you're not having fun, you're not doing it right!
The debian packages are pretty out of date (since 2.4.19 took _forever_), I'll be uploading new ones tonight.
/proc/misc should definitely not be empty; is the device mapper driver loaded in the kernel? (lsmod |grep dm, if it's compiled as a module).
Quoted 36 lines · On Wed, Aug 14, 2002 at 02:47:28PM -0400, [email protected] wrote:
In a message dated: Wed, 14 Aug 2002 18:45:47 BST
Quoted 2 lines · Joe Thornber
device-mapper is the kernel driver used by LVM2, there should be a debian package for this too.
I've tried that, and even installing the device-mapper from sources.
For some reason the
devmap_mknod.shscript is unable to create the/dev/device_mapper/controlfile. It appears that the problem is an inability to find the minor number from/proc/misc, which happens to be empty.Did I forget to configure something in my kernel which should be appearing in my
/proc/miscfile?Thanks,
Signature · 15 lines
Seeya, Paul -- It may look like I'm just sitting here doing nothing, but I'm really actively waiting for all my problems to go away. If you're not having fun, you're not doing it right! _______________________________________________ linux-lvm mailing list [email protected] http://lists.sistina.com/mailman/listinfo/linux-lvm read the LVM HOW-TO at http://www.sistina.com/lvm/Pages/howto.html
Signature · 2 lines
Broad surveillance is a mark of bad security. -- Bruce Schneier
In a message dated: Wed, 14 Aug 2002 15:37:54 EDT
Quoted 2 lines · Andres Salomon
The debian packages are pretty out of date (since 2.4.19 took _forever_), I'll be uploading new ones tonight.
Oh. okay. I guess I can wait until tomorrow to play then :)
Thanks.
Quoted 2 lines
/proc/miscshould definitely not be empty; is the device mapper driver loaded in the kernel? (lsmod |grep dm, if it's compiled as a module).
Well, that's the interesting part. I'm not using modules, so I don't know how to tell. Here are the steps I took to build the device-mapper:
1. cd device-mapper.0.96.03
2. ./configure --prefix=/usr/local
3. ( Using 2.4.18, no applicaple patches that I could find )
cd /usr/src/linux && configure/build/install new kernel
cd device-mapper.0.96.03/kernel
make symlinks
4. cd .. (back to top directory
make
make install
5. cp scripts/devmap_mknod.sh /etc/init.d update-rc.d devmap_mknod.sh defaults 10
6. reboot using new kernel
7. test using dmsetup:
# dmsetup version
Library version: 0.96.03-ioctl (2002-06-27)
Couldn't open device-mapper control device Command failed
Which I've since traced to the fact that /proc/misc is empty, and therefore contains no minor number to use for the creation of /dev/device_mapper/control.
I guess the point I'm a little confused about is this. What is /proc/misc ? What's supposed to be in there, and why isn't it :)
I've never heard of /proc/misc before today. That may be because it's primarily used with modular kernels and I tend to stay away from modules, preferring to compile everything directly in.
Thanks!
Signature · 7 lines
Seeya, Paul -- It may look like I'm just sitting here doing nothing, but I'm really actively waiting for all my problems to go away. If you're not having fun, you're not doing it right!
Quoted 9 lines · On Wed, Aug 14, 2002 at 03:50:38PM -0400, [email protected] wrote:
In a message dated: Wed, 14 Aug 2002 15:37:54 EDT
Quoted 2 lines · Andres Salomon
The debian packages are pretty out of date (since 2.4.19 took _forever_), I'll be uploading new ones tonight.
Oh. okay. I guess I can wait until tomorrow to play then :)
Quoted 8 lines
Thanks.
Quoted 2 lines
/proc/miscshould definitely not be empty; is the device mapper driver loaded in the kernel? (lsmod |grep dm, if it's compiled as a module).Well, that's the interesting part. I'm not using modules, so I don't know how to tell. Here are the steps I took to build the device-mapper:
Once you've patched the kernel go into make (x|menu)config and check that the device-mapper option is available and selected under the 'Multi-device support (RAID and LVM)'. If it's not available you haven't patched the kernel correctly. Also I would encourage you to upgrade to a 2.4.19 kernel.
- Joe
Quoted 1 line · On Wed, Aug 14, 2002 at 03:50:38PM -0400, [email protected] wrote:
make symlinks
This is only meant as a convenience for developers. It doesn't update the kernel config / makefiles, or apply any of the other necessary patches.
device-mapper is not in your kernel.
I'll update the install document for the next release to make things clearer.
During the current development phase, we're only supporting one kernel at once - currently it's 2.4.19. Supporting more kernels would take up too much of our time, I'm afraid, as we're only a small team.
If you can use 2.4.19, use the latest tarball (beta 5) from
ftp://ftp.sistina.com/pub/LVM2/device-mapper/device-mapper.0.96.04.tgz
Configure and make apply-patches, enable device-mapper in your kernel configuration and rebuild.
Otherwise your best bet is to download the last release that *did* support 2.4.18 and use that (beta 2):
ftp://ftp.sistina.com/pub/LVM2/device-mapper/old/device-mapper.0.95.07.tgz
Compare it with the current release and work out what needs changing to bring it up-to-date, or else put up with any bugs it contained that we have fixed since.
Alasdair
Signature · 1 line
[email protected]
In a message dated: Wed, 14 Aug 2002 21:27:31 BST
Quoted 6 lines · Alasdair G Kergon
If you can use 2.4.19, use the latest tarball (beta 5) from
ftp://ftp.sistina.com/pub/LVM2/device-mapper/device-mapper.0.96.04.tgz
Configure and make apply-patches, enable device-mapper in your kernel configuration and rebuild.
Okay, I'll do this.
Thanks!
Signature · 7 lines
Seeya, Paul -- It may look like I'm just sitting here doing nothing, but I'm really actively waiting for all my problems to go away. If you're not having fun, you're not doing it right!
Quoted 2 lines
- Can I use it to extend a RAID 5 set,
or concatenate 2 RAID 5 sets together?
I think the core answer to a lot of your questions is that LVM doesn't do RAID (other than a form of RAID0) itself. Most of the time what LVM does is concatenation, and relies on RAID being done at a lower level, i.e. you use a RAID set as a PV.
LVM won't actually coalesce two RAID5 sets together into a single RAID5 set, but you can get the effect of concatenation.
If you have two RAID5 sets, you can make each one into a PV, and then add both of those PVs into the VG. You still have two distinct RAID5 sets, but LVM will present it to you as one big area.
You can then create LVs in the VG, and create filesystems on the LVs. You can cheerfully create an LV which is bigger than the largest PV, or even one big LV which fills the entire VG.
If you already have data on a RAID5 set, and you want to convert it to LVM use, then you can't keep the data that is already on there.
Composing your VG out of RAID devices (rather than simple disk partitions) is the way to go. If you lose one PV, you tend to lose the whole VG. So it's a good idea to find some way of making your PVs resilient.
Re extending RAID5 sets, LVM won't help you to do that per se, i.e. it won't help you extend an existing RAID 5 set per se.
However if you already have a RAID5 set which you have put in a VG, and you get a new RAID5 set on your system (e.g. adding a new RAID5 system, or making a new RAID5 set out of some newly available disk space), then you can add that new RAID5 set to the VG. You can then extend your existing LVs into the new space in the VG, or create new LVs.
(( A lot of people seem to want LVM to do magic on their existing systems which are full of data, which is something it doesn't do. You are going to need to backup-and-restore, or set up LVM on new disks.
However, once you have subscribed to the LVM philosophy, bitten the bullet, and migrated your existing system over to LVM, then adding new space is trivially easy.
The real trick is to put in LVM on day one even if you're not sure you need it.
Like putting data cabling into a building, it's easy to put in at the beginning when the building is being built, but harder to put in later when you realise you need it. ))
Quoted 2 lines
- Can I use LVM to combine different types of RAID, such as 1 and 0?
Yes. You can have several PVs of different RAID types.
You can even tell LVM on which PV you want it to put each LV. You can even move parts of LVs or whole LVs to a different PV, after creation, without losing data.
However if you have some PVs with redundancy (e.g. RAID1 (mirrored)) it would probably not be sensible to mix them with non-redundant PVs (e.g. RAID0 (striped)). This is because the VG is only as strong as the weakest link.
Quoted 1 line
- Can I easily "grow" a RAID set using LVM?
Same question as the first part of your first question?
Quoted 4 lines
The other question I had more directly relates to the Linux implementation for LVM:
- Which version do I use?
Can't give you a complete answer because I have never used LVM2. I use LVM1 on a number of machines and it works fine for me. I use kernel 2.4.18 with LVM1.0.x patch, with Debian 3.0 (Woody) lvm10 (LVM1.0.4) userland tools.
Although you would need to give some more information about your situation. You are using Debian unstable which suggests you want to live on the bleeding edge, but you are also using RAID5 which suggests you want to make a stable reliable system. AFAICT these two goals are incompatible.
Quoted 1 line
Is lvm10 the 1.x series and lvm2 the 2.x? Or does lvm10 come after lvm2?
The former.
Quoted 1 line
If the former, is 2.x stable enough to use,
Same question as "Which version do I use?".
Quoted 2 lines
and is it better to
compile lvm from source or use the pre-compiled debian packages?
For LVM1: I have found the pre-compiled debian packages to be OK.
Quoted 4 lines
I've tried both the lvm10 and lvm2 packages, but continually recieve errors when I do things like run lvdisplay (it complains about not being able to flush the device several times), and also something about not being able to open the device-mapper.
For LVM1: I believe the errors about flushing are fine.
Bill
Signature · 19 lines
William H. Blunn - <[email protected]> - Developer Support Tao 62/63 Suttons Business Park, Earley, READING, RG6 1AZ, United Kingdom Tel: +44 118 901 2999 - Fax: +44 118 901 2963 - http://tao-group.com/ The contents of this e-mail and any attachments are confidential and may be legally privileged. If you have received this e-mail and you are not a named addressee, please inform us as soon as possible on +44 118 901 2999 and then delete the e-mail from your system. If you are not a named addressee you must not copy, use, disclose, distribute, print or rely on this e-mail. Any views expressed in this e-mail or any attachments may not necessarily reflect those of Tao's management. Although we routinely screen for viruses, addressees should scan this e-mail and any attachments for viruses. Tao makes no representation or warranty as to the absence of viruses in this e-mail or any attachments. Please note that for the protection of our business, we may monitor and read e-mails sent to and from our server(s). Visit our website at http://tao-group.com/
-- William Blunn <[email protected]>
Quoted 2 lines
Quoted 2 lines
- Can I use it to extend a RAID 5 set,
or concatenate 2 RAID 5 sets together?
If you want better speed and are willing to use up more space on parity, striping across RAID5 PV's is a nice, stable way to go. RAID5 works better if the stripe size is equal to the I/O page. So, let's say that you have 8 drives in two RAID5 sets with 4 disks each. Also say that the chunk size is 1K, leaving the total stripe at 4K.
You can combine the two PV's together into, say, vg01. With 9GN drives this gives you 27 x 2 = 54GB of space.
Now you can create LV's with a 4K stripe on the two RAID sets. The striping is less of a risk because it is unlikely for one of the RAID5 PV's to loose data. Result is that you get the speed benefit without much risk at all.
It is probably a bad idea to mix RAID types within the same VG. You probably have a reason for using one type of RAID mechanism over the other; mixing them only makes it harder to use properly.
Concatenating groups of similarly RAID-ed hardware into larger blocks of space is quite handy.
--
Steven Lembark 2930 W. Palmer
Workhorse Computing Chicago, IL 60647
+1 800 762 1582
Thank you very much for you insightful answers to my questions! (I've responded to a few comments/questions of yours below).
In a message dated: Thu, 15 Aug 2002 11:14:59 BST
Quoted 3 lines · William Blunn
A lot of people seem to want LVM to do magic on their existing systems which are full of data, which is something it doesn't do. You are going to need to backup-and-restore, or set up LVM on new disks.
Well, I'm not looking for magic, just neat things to play with, new ways of doing things, and easier methods of managing disk space :)
Quoted 1 line
The real trick is to put in LVM on day one even if you're not sure you need it.
Well, that's sort of what I'm doing. I'm currently in an environment where there is nothing, and everything important is being managed by "Someone Else". Therefore, I'm free to play for now. Hopefully, if I can come up with a good solution, I can replace the "Someone Else" in the future, since the groups I work with doesn't really like them :)
Quoted 4 lines
Although you would need to give some more information about your situation. You are using Debian unstable which suggests you want to live on the bleed ing edge, but you are also using RAID5 which suggests you want to make a stable reliable system. AFAICT these two goals are incompatible.
Yes I'm currently using Sid, and yes I realize that it's "bleeding edge", and yes, I mention RAID5 which indicates I'd like a stable/reliable system. However, I'm "playing" right now, and since I run Sid on all my other systems, I just grabbed it out of reflex. Since Woody is recently released, when/if I go into production mode, I'll probably switch to that.
Here's what I'm thinking of doing. I have a bunch of 1u rack-mount systems which each have 4 80GB drives in them. In the near future, I'm likely to have identical systems with 160GB drives in them instead. Out of all that disk space, I'm using less than 2GB on the primary IDE master drive.
What I was thinking, was to combine LVM with NBD (Network Block Device). This would allow me to set up one or two nodes as the "file server" using LVM. When I created add a new node to my environment for some reason, I'll set it up with the nbd-server to serve out it's drives. The "file server" node could then exploit the unused disk space on this new node in the environment.
For "reliability of data" I was thinking of using either ext3 or reiserfs across a RAID set. Though, because I wasn't completely sure of how LVM worked wrt RAID, I was unsure where to do the RAID, at the back-end on the system where the disks physically reside, or on the front-end, where I'm using LVM.
What I'm thinking of now is to not use RAID at all, rather just use LVM, and maybe use RAID to mirror VGs.
I'm well aware that this is probably insane and won't work as I'd ideally like it to. But as I said, I have a lot of free time, and I like to learn new things. NBD and LVM *seem* to be made for each other. They both may be a little too experimental at this point in time, which is okay, I can afford that risk, and maybe, by doing this, I may find better ways of doing what I want.
So, that's the scoop on what I'm trying to do. Comments, questions, concerns? :)
Thanks again!
Signature · 7 lines
Seeya, Paul -- It may look like I'm just sitting here doing nothing, but I'm really actively waiting for all my problems to go away. If you're not having fun, you're not doing it right!