LVM How-To by Lennart
Tim Writer
tim-s/rLXaiAEBtBDgjK7y7TUQ at public.gmane.org
Wed Jan 17 18:01:21 UTC 2007
Merv Curley <mervc-MwcKTmeKVNQ at public.gmane.org> writes:
> On Tuesday 16 January 2007 23:50, Tim Writer wrote:
>
> Hello Tim
>
> I know top posting is frowned on but no need to make you chase through the
> message for this. Thanks for the additional comments and examples, I hope
> that I can start to use the proper terms for working with LVM Groups. Now
> that I have an idea what this system is all about, the HOW-TO should make
> much more sense. It is just so long and detailed that I really got lost
> before the concepts sank in. Then any Linux documentation that is 4 years old
> is kinda suspect in my mind.
That's reasonable. In this case, most of it is okay and relevant. Just
ignore anything to do with installation of kernels and the LVM software
(this should be handled by your distribution) and other distribution
specific thinks, like the procedure for creating root on LVM. Most distros
have good tools for doing that now. For example, Debian's mkinitrd handles
it correctly.
> After I installed this new drive on this computer [not my Mythtv backend], I
> was tempted to make 3 small Primary partions for distro /boot use and one
> large Vol Group, but I chickened out, not knowing what I was getting into.
>
> Now that I have your example, I see that is what I should have done. During
> the day, I'll consider re-doing this drive before I put any more work on it.
> s
With LVM, you should be able to migrate your data from the old drive to the
new, so that you can repartition the old drive without needing to
reinstall. Due to the vagaries of PC hardware, BIOSes, boot managers,
etc. this can be non-trivial with your boot drive and I wouldn't do it
until you're comfortbale with LVM (i.e. test it on a test system, if you
have one).
Before you attempt root on LVM (i.e. partition your disk into /boot and a
large volume group), you should be comfortable with mounting LVM volumes
from a live CD, such as KNOPPIX, Ubuntu Live, or RIP.
Other than that, don't be afraid of LVM. It gives you a lot of flexibility
and, IMO, is the best way to setup any Linux box.
> Again thanks and for saving Lennart a bunch of typing, altho he might just
> pipe up anyway :-)
No problem.
> I am hoping that this ends this thread, but these 77 year old grey cells
> aren't so nimble anymore.
No need to end it. Some good LVM examples on this list might stop a lot of
those other questions like how to repartition a disk, how to mount a second
disk, etc.
Good luck.
> Cheers
>
>
>
> > Merv Curley <mervc-MwcKTmeKVNQ at public.gmane.org> writes:
> > > On Monday 15 January 2007 16:18, Lennart Sorensen wrote:
> > > > On Fri, Jan 12, 2007 at 08:09:15PM -0500, Merv Curley wrote:
> > > > > Thanks for the instructions Lennart. From what stuck in the grey
> > > > > cells from the HOW-TO, it seemed to make sense. I assume that
> > > > > somewhere in the second stage I format the 'newdisk' with ext3 to
> > > > > match the present part of the logical volume?
> > > >
> > > > No. You are extending an existing filesystem I imagine. If you don't
> > > > want to expand an existing logical volume, you can create a new logical
> > > > volume with lvcreate and format that afterwards.
> > >
> > > hda on the Myth system, has a primary partition for /boot, a VolumeGroup
> > > [rootvg] for the Myth install / and the swap; and a VolumeGroup for
> > > Myth Data [videovg]. I have a 320 GB drive [hdb] that I thought could
> > > extend the videovg group.
> >
> > You can. Once you have extended it you have a choice. You can extend
> > existing logical volumes (using lvextend) or you can create new logical
> > volumes. New logical volumes would required to create file system on them
> > before mounting. Existing logical volumes likely already have a file system
> > which you can simply resize (e.g. using resize2fs) once you have extended
> > the volume using lvextend.
> >
> > You complained about the LVM HOWTO but it's actually comprehensive. I think
> > it would be a good idea for you to spend some more time with it, perhaps on
> > an experimental system, to be sure you understand the concepts.
> >
> > > > The vgdisplay should show how many free extents are unused (not used by
> > > > any logical volume). That is how many extents you can potentially add
> > > > to any existing logical volume.
> > >
> > > Well it seems that vgdisplay didn't return what it should have because I
> > > didn't use the VolumeGroup name. I just tried again and
> > >
> > > vgdisplay videovg [now sez among other things]
> > >
> > > Max PV 0 0 Cur PV 1 1 Act PV 1 1
> > > VG size 225.88 PE Size 32 MB
> > > Total PE 7228> >> not VMS. It's not MVS. All of those systems had
> special portions of
> > >> filenames known as an "extension." Unix doesn't do that.)
> > > Alloc PE/Size 7227 / 225.88
> > > Free PE/Size 1 / 32 MB
> >
> > This is before running vgextend, correct? You only have one PV (physical
> > disk partition) and 1 free extent (block of 32MB available for use by LVM).
> > You need to use pvcreate to prepare your new disk for use with LVM and add
> > that PV to your existing volume group using vgextend. At that point, you
> > should have free extents.
> >
> > > Is that better?
> >
> > No. See above.
> >
> > > How many free extents are there, just 1?
> >
> > Yes.
> >
> > > Is this second drive going to be videolv02 for mounting purposes in fstab
> > > and a part of the 'videovg group?
> >
> > Absolutely not. When using LVM, you don't mount (physical) drives or
> > partitions, you mount logical volumes. The purpose of LVM is to provide a
> > layer between the file system and physical disks. It allows you to resize
> > your logical disks (logical volumes) by adding and removing physical disk
> > resources. You can then grow and shrink file systems without needing to
> > backup and restore them.
> >
> > Let me give you a concrete example. My laptop has a single physical
> > disk. It has four physical partitions: 8GB for XP (yuck!), 512MB for the
> > laptop diagnostics, 256MB for /boot, and the remaining 25GB as a single PV
> > for LVM.
> >
> > The PV comprises (is allocated to) a single volume group, vg0. Within vg0,
> > I have the following logival volumes:
> >
> > /dev/vg0/ub606_root
> > /dev/vg0/ub606_usr
> > /dev/vg0/ub606_var
> > /dev/vg0/home
> > /dev/vg0/ub610_root
> > /dev/vg0/ub610_usr
> > /dev/vg0/ub610_var
> >
> > When running Ubuntu 6.10, I have the following mounts:
> >
> > /dev/vg0/ub610_root on /
> > /dev/vg0/ub610_usr on /usr
> > /dev/vg0/ub610_var on /var
> > /dev/hda3 on /boot type
> > /dev/vg0/home on /home type
> >
> > I have free space in vg0, as you will have after you extend it with
> > pvcreate and vgextend. I can add some of that free space to /home as
> > follows:
> >
> > umount /home
> > lvextend -L +4G /dev/vg0/home
> > resize2fs /dev/vg0/home
> > mount /home
> >
> > At this point, I'll have an additional 4GB of usable space in /home. Note
> > that I didn't need to backup and restore /home, and I didn't need to make a
> > new file system.
> >
> > [snip]
> >s
>
> > Hope this helps,
>
> --
> Merv Curley
> Toronto, Ont. Can
>
> SuSE 10.2 Linux
> Desktop KDE 3.5.5 KMail 1.9.5
>
>
>
> --
> The Toronto Linux Users Group. Meetings: http://gtalug.org/
> TLUG requests: Linux topics, No HTML, wrap text below 80 columns
> How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
>
--
tim writer <tim-s/rLXaiAEBtBDgjK7y7TUQ at public.gmane.org> starnix inc.
647.722.5301 toronto, ontario, canada
http://www.starnix.com professional linux services & products
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list