old-www/HOWTO/LVM-HOWTO/benefitsoflvmsmall.html

352 lines
7.5 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>Benefits of Logical Volume Management on a Small System</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="LVM HOWTO"
HREF="index.html"><LINK
REL="UP"
TITLE="What is Logical Volume Management?"
HREF="whatisvolman.html"><LINK
REL="PREVIOUS"
TITLE="Why would I want it?"
HREF="whywouldiwantit.html"><LINK
REL="NEXT"
TITLE="Benefits of Logical Volume Management on a Large System"
HREF="benefitsoflvmlarge.html"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>LVM HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="whywouldiwantit.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 2. What is Logical Volume Management?</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="benefitsoflvmlarge.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="benefitsoflvmsmall"
></A
>2.2. Benefits of Logical Volume Management on a Small System</H1
><P
>&#13; One of the difficult decisions facing a new user installing Linux
for the first time is how to partition the disk drive. The need to
estimate just how much space is likely to be needed for system
files and user files makes the installation more complex than is
necessary and some users simply opt to put all their data into one
large partition in an attempt to avoid the issue.
</P
><P
>&#13; Once the user has guessed how much space is needed for /home /usr /
(or has let the installation program do it) then is quite common
for one of these partitions to fill up even if there is plenty of
disk space in one of the other partitions.
</P
><P
>&#13; With logical volume management, the whole disk would be allocated
to a single volume group and logical volumes created to hold the /
/usr and /home file systems. If, for example the /home logical
volume later filled up but there was still space available on /usr
then it would be possible to shrink /usr by a few megabytes and
reallocate that space to /home.
</P
><P
>&#13; Another alternative would be to allocate minimal amounts of space
for each logical volume and leave some of the disk unallocated.
Then, when the partitions start to fill up, they can be expanded as
necessary.
</P
><P
>&#13; As an example:
Joe buys a PC with an 8.4 Gigabyte disk on it and installs Linux
using the following partitioning system:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;/boot /dev/hda1 10 Megabytes
swap /dev/hda2 256 Megabytes
/ /dev/hda3 2 Gigabytes
/home /dev/hda4 6 Gigabytes
</PRE
></FONT
></TD
></TR
></TABLE
>
This, he thinks, will maximize the amount of space available for all his MP3
files.
</P
><P
>&#13; Sometime later Joe decides that he want to install the latest
office suite and desktop UI available but realizes that the root
partition isn't large enough. But, having archived all his MP3s
onto a new writable DVD drive there is plenty of space on /home.
</P
><P
>&#13; His options are not good:
</P
><P
></P
><OL
TYPE="1"
><LI
><P
>&#13; Reformat the disk, change the partitioning scheme and
reinstall.
</P
></LI
><LI
><P
>&#13; Buy a new disk and figure out some new partitioning scheme
that will require the minimum of data movement.
</P
></LI
><LI
><P
>&#13; Set up a symlink farm on / pointing to /home and install the new
software on /home
</P
></LI
></OL
><P
>&#13; With LVM this becomes much easier:
</P
><P
>&#13; Jane buys a similar PC but uses LVM to divide up the disk in a similar
manner:
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;/boot /dev/hda1 10 Megabytes
swap /dev/vg00/swap 256 Megabytes
/ /dev/vg00/root 2 Gigabytes
/home /dev/vg00/home 6 Gigabytes
</PRE
></FONT
></TD
></TR
></TABLE
><DIV
CLASS="note"
><P
></P
><TABLE
CLASS="note"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>&#13; boot is not included on the LV because bootloaders don't
understand LVM volumes yet. It's possible boot on LVM will
work, but you run the risk of having an unbootable system.
</P
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="warning"
><P
></P
><TABLE
CLASS="warning"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/warning.gif"
HSPACE="5"
ALT="Warning"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>root on LV should be used by advanced users only</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>&#13; root on LVM requires an initrd image that activates the root
LV. If a kernel is upgraded without building the necessary
initrd image, that kernel will be unbootable. Newer
distributions support lvm in their mkinitrd scripts as well
as their packaged initrd images, so this becomes less of an
issue over time.
</P
></TD
></TR
></TABLE
></DIV
><P
>&#13; When she hits a similar problem she can reduce the size of /home by
a gigabyte and add that space to the root partition.
</P
><P
>&#13; Suppose that Joe and Jane then manage to fill up the /home
partition as well and decide to add a new 20 Gigabyte disk to their
systems.
</P
><P
>&#13; Joe formats the whole disk as one partition (/dev/hdb1) and moves
his existing /home data onto it and uses the new disk as /home. But
he has 6 gigabytes unused or has to use symlinks to make that disk
appear as an extension of /home, say /home/joe/old-mp3s.
</P
><P
>&#13; Jane simply adds the new disk to her existing volume group and
extends her /home logical volume to include the new disk. Or, in
fact, she could move the data from /home on the old disk to the new
disk and then extend the existing root volume to cover all of the
old disk.
</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="whywouldiwantit.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="benefitsoflvmlarge.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Why would I want it?</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="whatisvolman.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Benefits of Logical Volume Management on a Large System</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>