Step Three • LVM (part 1)

7. LVM partitioning

  1. Configure the Logical Volume Manager (LVM)
  2. Create volume group
  3. Create logical volumes
7. LVM partitioning

7a. Configure the Logical Volume Manager

This is where the previous page ended:

Two partitions

We are going to configure the Logical Volume Manager.

Configure

With Configure the Logical Volume Manager selected, hit Enter. You'll be asked if you want to write the changes to your disk:

Select <Yes> using the Tab key or the right or left arrow keys, then hit Enter. You'll see a summary:

Summary

7b. Create volume group

The big primary partition we've made is going to hold logical volumes. Those logical volumes must be assigned to a volume group. Therefore, we must create the group first.

Using your keyboard's arrow keys, select Create volume group.

Create volume group

Hit Enter. You'll be asked to give the volume group a name.

Name volume group

If you're going to create more than one volume group, you might want to number them. If you're going to create just one volume group, like we do here, you may give it any name. You could let the name precede by vg for easier recognition by yourself later. You could name the volume group: vgSystem. Enter the name of your choice, then press Enter.

Now you've got to choose the device (disk) for your volume group:

Device

There's not much to choose if you've only got one disk. You've got to select this disk by hitting the space bar.

Selected

After hitting the space bar you see that an asterisk * has appeared on the red spot between the brackets. This means you have selected this device. Hit Enter.

The summary shows that indeed you have created one volume group:

Summary

7c. Create logical volumes

Now it's time to create logical volumes. Your server needs the following 6 directories: swap, root, srv, usr, home and var. Let's assume you've got a 40 GB hard disk or bigger. You could than create volumes, adding lv to their names for later recognition, and choose the sizes in the middle column:

total 40000M 8500M
lvswap 4000M 400M
lvsrv 4000M 1000M
lvusr 4000M 400M
lvhome 4000M 400M
lvroot 10000M 400M
lvvar 14000M 5900M

If your disk is smaller, make your own calculations. The last column is for a VMWare partition of 8500 MB. Should your disk be bigger than 40 GB, lvvar will get more.

So let's start. Select Create Logical Volume:

Create logical volume

Hit Enter. You must now select the volume group your new volume is going to belong to. There's not so much choice, as you can see:

Select volume group

Hit Enter. Your system is going to need swap space to temporarily store data during processing. Swap frees process memory for your computer. Without swap space you'd notice hickups while your PC is working.

Create lvswap

Type lvswap and hit Enter. You'll be asked to enter the size:

Size

If your disk is big enough, type 4000M. If your disk is small, make your own calculation. Hit Enter.

Create more

As you can see in the summary, one logical volume was added to the list.

Now create more logical volumes using the following names and sizes:

lvsrv 4000M
lvusr 4000M
lvhome 4000M
lvroot 10000M

You start by selecting Create logical volume and hitting Enter each time. For every logical volume you go through the same cycle as we did for lvswap, i.e. selecting the (only) volume group, typing a name, choosing the right size (mostly 4000M) et cetera.

The last volume we create is lvvar. When it's time to choose it's size, don't touch it, so lvvar will get all the free space that was left. If you have a 40 GB disk, that'll be about 14 GB. If your disk is bigger, it'll be more. Just hit Enter. You'll get this summary:

Summary

With Display configuration details selected, hit Enter.

Configuration

As you can see, all logical volume you created are there. With Continue selected, hit Enter.

Finish

With Finish selected, hit Enter. Sounds like we're ready, but we're not. You'll get this overview:

Overview

Now we've got to choose the file system and mount point for our volumes. We'll do this on the next page.

Drag this box to where you want it
vi | shell
command action command action
su become superuser rm foo delete file foo
ls show files & directories rmdir foo delete directory foo
ls -a show invisible items too rm -rf foo delete dir foo + content
ls -l show long names chmod change permissions
ls -la show long and invisible chmod 755 foo set 755 for foo
cd change directories vi /etc/foo open file foo in vi
cd / go to root directory apt-get install get and install application
cd /etc go to etc via root tar -xzvf extract zip file
cd /tmp go to temp via root exit finish terminal session
/etc/init.d/restart apache2 restart the Apache server
/etc/init.d/status apache2 show if the Apache server is running
shutdown -h now shutdown the system immediately
shutdown -r shutdown and reboot the system
vi | shell
<= keyboard hits => action
  i   insert (start editing)
  arrows   move around
  backspace   delete to the left
  delete   delete to the right
  esc   stop editing
esc :w enter stop editing, save changes and keep vi open
esc :wq enter stop editing, save changes and exit vi
esc :q enter stop editing, exit vi without saving

Assistance

vi & shell

Contact