[sclug] What to use LVM for

Andy Smith andy at lug.org.uk
Wed Mar 15 16:28:22 UTC 2006


On Wed, Mar 15, 2006 at 03:59:57PM +0000, John Stumbles wrote:
> Thinking of how to partition my new 300G hdd for my desktop I'm 
> wondering about LVM.

You should probably also wonder about getting another 300G and doing
LVM on top of software RAID-1 as well, as 300G is a lot of data to
have to restore from backup when the disk dies...

> It seems I could add the whole drive to a volume group and
> allocate all my partitions out of that. Is it safe/possible to do
> this for my root and swap partions as well as /home and any others
> or should I have those as old fashioned cast-in-stone partitions?

It is safe to do it for swap.

You can't do it for /boot as grub won't be able to read it without
some hacks.

Also if you put / in LVM (or software RAID) then you will need to be
booting with an initrd that understanmds LVM (and software RAID, if
used).  This is perfectly safe though, as long as you don't mind
initrd.

I don't like initrd so I usually do:

- a 128MiB /boot on RAID-1

  (must be -1 as grub can't read other RAID levels)
  
- a 1 or 2GiB / on my chosen RAID level

- a sensible amount of swap under RAID-1

  (swap needs to be RAIDed too otherwise machine dies when disk dies
  and unscheduled reboots are bad)
  
- another RAID device that takes up the rest of the space

  This gets used as a PV for LVM, and all other filesystems are from
  in here.  Since it's LVM I don't have to worry about getting the
  sizes exactly right first time, nor about how many LVs I have, so
  I usually make LVs for at least:

  /home
  /usr
  /var
  /tmp

  often also:

  /opt
  /usr/local
  /var/tmp

> And if so how does one set up LVM when doing a debian (sarge) install? I 
> can't remember (and don't yet have a machine handy to try it on) if LVM 
> is an option during the install process. Will there be anything 
> machine-specific I'll wish I'd found out before starting the 
> installation? :-)

Yup, there is a section in the manual disk partition part of the
debian installer for this.

Basically in the bit where it says what you want to use the
partition for, instead of specifying a filesystem you tell it to
make it an LVM physical volume (PV).

Then once finished with the partitioning you select the LVM config
bit and it will write your partitions, then go into the LVM config
where you will be able to specify volume groups (VGs).  A VG uses
one or more PVs.

You can then create logival volumes (LVs) inside your VG(s).

Once done you are returned to the partition configurator where you
can now specify what each active LV will be used for, as if they
were a normal partition.

Hope that helps.

-- 
http://strugglers.net/wiki/Xen_hosting -- A Xen VPS hosting hobby
Encrypted mail welcome - keyid 0x604DE5DB
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.tmdg.co.uk/pipermail/sclug/attachments/20060315/bc4aeb2f/attachment.bin


More information about the Sclug mailing list