[linux-lvm] Hardware Raid - LVM the way to go?
chris_cox at stercomm.com
Tue Jul 6 15:47:57 UTC 2004
Michael Bellears wrote:
> We have a new Compaq server, with a Raid Controller capable of handling
> 12 SCSI HD's - We currently only have 5 (In Raid 5)
> We want to be able to "grow" the data partition as need dictates(i.e.
> Add new HD's, grow the Raid 5 array, and data partition) - LVM looks the
> way to go.
> My *usual* partitioning scheme, is:
> /dev/cciss/c0d0p1 /boot (100M)
> /dev/cciss/c0d0p2 / (all of the disk not used by /boot and swap.)
> /dev/cciss/c0d0p5 /swap (~1G)
> I'm installing via Debian-Installer(Beta-4) - Which gives LVM
> options...Would I create all my partitions as per my "normal" setup, but
> mark them as LVM?
Sort of. You actually mark partitions (or whole disks) as physical
volumes (PVs) and then assign the PVs to a volume group (VG) and then
you can start carving out areas called logical volumes (LVs)... which
translate to you old idea of what partitions are used for.
You can then use lvextend when necessary to extend the size of
any logical volume and if you have a filesystem that is dynamically
resizeable... you can use the filesystem specific tool to resize it
to fill the extra LV space.
Let's say you have a partition /dev/cciss/c0d0p1 that is 10G in size and
you have used your partitioning tools to type the partition as LVM.
Now you can make it a PV:
# pvcreate /dev/cciss/c0d0p1
After you have created the PVs you want.... you can add them to
existing VGs or you may want to create a VG.
# vgcreate debianvg /dev/cciss/c0d0p1
Create your LVs:
# lvcreate -L 2G -n usr debianvg
(you'll end up with a /dev/debianvg/usr with 2G of size)
# lvcreate -L 4G -n home debianvg
# lvcreate ...etc...
Make a filesystem on your LVs:
# mkreiserfs /dev/debianvg/usr
# mkreiserfs /dev/debianvg/home
Now after installation.. let's say you want to enlarge /usr (assuming
you mounted /dev/debianvg/usr at /usr) by 1G.
# lvextend -L +1G /dev/debianvg/usr
# resize_reiserfs /dev/debianvg/usr
Reiser will allow you to resize without having to umount
the partition. Depending on your filesystem choice, you may
have to umount the partition in order to resize it.
I too use the Compaq/HP equipment. I usually create a dedicated
VG for the OS (to hold /usr,/opt,/tmp,/var,etc) and then other
VGs for user data (/home, etc.... though I usually call it
/localhome to avoid automount issues with things like NIS).
So I will have at least 2 partitions... or possibly two
raid disks (e.g. I might create a mirror of two drives for
the OS VG and raid5 the other drives for user data VGs).
I would avoid placing / under LVM, just for some flexibility...
and therefore, you want to think about the number of LVs you'll
want to create to avoid things going needlessly into /. I
use unique VG names to avoid issues should a disk get moved
into another host. I still create a small /boot area, though
arguably that won't be needed anymore. It's also outside of
LVM and since it's usually small, I use ext2.
With today's larger disks and with journaled filesystems, I
usually don't create a journaled fs that's less than 750M.
But that's my minimum nowadays.
swap (whatever size you need)
/ 300M reiserfs
/boot 60M ext2 (probably more than most will need, depends on
how many kernels you tend to keep around)
Now the OS VG:
/usr 2.5G reiserfs (usr LV)
/opt 1.5G reiserfs (opt LV) (smaller probably for non-SUSE dists)
/var 750M reiserfs (var LV)
/var/lib 750M reiserfs (varlib LV) (for SUSE again, for YaST update space)
/tmp 750M reiserfs (tmp LV)
Now from the user data VG:
/usr/local 1G reiserfs (local LV)
/localhome 1G reiserfs (home LV) (obviously both can be as large as you want)
Though I didn't mention this, you can grow a VG by adding more
PVs to it.
Whew... all of this is probably written up somewhere else.
More information about the linux-lvm