[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: new pc and swap



On Mon, Oct 31, 2016 at 01:27:22PM -0500, Richard Owlett wrote:
> To paraphrase Julius Caesar:
> omnia disci en tres partes est:
>   primary
>   extended
>   logical
> 
> Whither goest LVM?

LVM is a more flexible alternative to using a set of fixed-sized
partitions.

Under LVM, you create two (or more, but usually two) *real* partitions:
say, sda1 and sda1.  The first partition (sda1) is just formatted using
a straight file system, used for /boot.  The other partition (sda2)
is not given a file system; instead, it is turned into a Volume Group
(VG), which is sort of like a virtual disk.

Within the VG you have a whole bunch of "slices" or "physical extents"
(PE), each one being some fixed size like 4 MB or 16 MB.  The whole VG
therefore contains however many thousand PE make up the physical space.

When you want to actually use the disk, you create a "logical volume" (LV)
out of however many PEs you need.  If you're creating a 1 GB file system
for a disk with 4 MB PEs, then your new LV would consist of 256 PEs.
These don't have to be contiguous.  Once the LV is created, it is usable
just like a partition.  You can format it with a file system, and mount
it, and put files on it.  Or format it for swap, or whatever.

Typically you perform your LVM installation by setting up the file systems
and swap partitions (created on LVs) using minimum sizes, and leave most
of the VG unused.

Later, if you realize you need to increase the size of /usr by 8 GB,
you just increase the size of its LV (assigning some more PEs to it,
even if they're not contiguous to the original set), and then increase
the size of the file system to match.  With most unix-like file systems,
this doesn't require any down time (unmounting) at all.


Reply to: