1. Overview
When we install a new Linux Operating Systems (OS), it is a difficult decision to set how much space for each partition because those partitions would be filled up quickly for some reasons. With Logical Volume Manager (LVM) created during a Linux Operating Systems (OS) installation, we can resize the space for a particular partition easily without effecting the application and system restart.
In this article will show you how to install Debian Operating Systems (OS) which is mainly focus on Logical Volume Manager (LVM). Debian 8.4, Jessie, will be used for this demonstration, but the same approach should be applicable for all Debian version.
2. Prerequisites
In this article, it is assumed that:
a. You already have VMware Workstation 11 up and running on your computer.
b. You have already downloaded Debian 8.4, Jessie, installer image iso file from Debain website.
3. Understanding LVM
LVM gives you much more flexibility in allocating storage space to applications and users. It provides a virtual pool of memory space, called a Volume Group (VG), from which Logical Volumes (LV) can be generated if needed. The operating system accesses these Logical Volumes (LV) like conventional physical partitions.
This approach lets you resize and move logical volumes while they are still mounted and running without affecting the applications and no need to reboot the Operating System (OS) to make the kernel aware of the newly-created or resized partitions.
The following table illustrates the installation requirement that will be proceeded in this tutorial.
Disk | Physical Volume (PV) | Volume Group (VG) | Logical Volumes (LV) | Size | File System |
/dev/sda |
/dev/sda1 |
vg-systems |
lv-root | 3 GB | Ext4 |
lv-boot | 512 MB | Ext4 | |||
lv-swap | 1 GB | Ext4 | |||
lv-usr | 3 GB | Ext4 | |||
lv-var | 3 GB | Ext4 | |||
lv-home | 3 GB | Ext4 | |||
lv-tmp | 1 GB | Ext4 |
There is a rule to calculate swap disk space in Linux as the following.
- If RAM ≤ 4GB; => Swap = RAM x 2
- If RAM > 4GB; => Swap = RAM + 2
4. Creating Volume Group (VG)
After the Debian Operating System (OS) is booted up, the following screen appears.
Follow the on-screen options of the installation process until you reach at the following screen which is the important step that we need to choose a partitioning method. Since we have a specific requirement of the partitioning, we need to choose “Manual” from below screen.
Select the available disk device as below to configure partitions and mount points. A warning appears to confirm that all the in place partitions for the disk device will be removed. Since there is no any partition to keep, just select “Yes” to continue.
To create a volume group (VG), we need to choose the option “Configure the Logical Volume Manager” as lighted in below screen.
As we can see in the summary of the current LVM configuration below, there is no any volume group (VG) in place yet. So, let create a volume group (VG) by selecting the option of “Create volume group” as below.
From below screen let enters the volume group (VG) name as “vg-systems”.
We need to choose a disk device to create a volume group (VG). In our case now let select the device “/dev/sda” for the volume group (VG) name “vg-systems” created above.
5. Creating Logical Volumes (LV)
After having a volume group (VG) created, the next step is to create logical volumes. As in the requirement, there are 7 logical volumes that need to be created. Each logical volume (LV) will be mounted to its respective mount point, so let create them accordingly as the following.
1. Create logical volume (lv) for root partition: from below screen select option “Create logical volume” to start creating a logical volume.
The following screen appears to ask which volume group (VG) that we want to create the logical volume (LV) on. Since there is only one volume group (VG) name “vg-systems” in the list, just select it to continue.
From below screen provides a logical volume (LV) name as “lv-root” as the following.
Enter the size for the logical volume (LV) name “lv-root”. We can put the smallest number for now and increase it latter if need. Following the requirement let enter 3 GB.
2. Create logical volume (lv) for boot partition: from below screen provides a logical volume (LV) name as “lv-boot” as the following.
Following the requirement, enter the size as 512 MB for the logical volume (LV) name “lv-boot”.
3. Create logical volume (lv) for swap partition: from below screen provides a logical volume (LV) name as “lv-swap” as the following.
Following the requirement, enter the size as 1 BG for the logical volume (LV) name “lv-swap”.
4. Create logical volume (lv) for usr partition: from below screen provides a logical volume (LV) name as “lv-usr” as the following.
Following the requirement, enter the size as 3 GB for the logical volume (LV) name “lv-usr”.
5. Create logical volume (lv) for var partition: from below screen provides a logical volume (LV) name as “lv-var” as the following.
Following the requirement, enter the size as 3 GB for the logical volume (LV) name “lv-var”.
6. Create logical volume (lv) for home partition: from below screen provides a logical volume (LV) name as “lv-home” as the following.
Following the requirement, enter the size as 3 GB for the logical volume (LV) name “lv-home”.
7. Create logical volume (lv) for tmp partition: from below screen provides a logical volume (LV) name as “lv-tmp” as the following.
Following the requirement, enter the size as 1 GB for the logical volume (LV) name “lv-tmp”.
There is no more logical volume to create, so select option “Finish” to finish creating logical volumes.
6. Selecting Logical Volume (LV) File Systems And Mount Points
After all the required logical volumes (lv) are created, we need to select a particular file system for them and mount them to their respective partitions. In our case now, we will use ext4 file system for all the created logical volumes.
The ext4 is the enhancement of ext3 by increase performance with multiple various techniques and it is a journaling file system.
1. Selecting file system and mount point for logical volume (LV) boot: from below screen, select the logical volume (LV) name “lv-boot” to choose a file system and mount point for it.
In the following screen, press enter for file system and mount point options to be appear.
Select ext4 to be the file system for logical volume (LV) name “lv-boot” as the following.
Select “Mount point” option as the following and press enter for a list of mount point to select.
Select partition “/boot” to be the mount point for logical volume (LV) name “lv-boot” as the following.
After file system and mount point for logical volume (LV) “lv-boot” have been selected, choose option “Done setting up the partition” to finish.
2. Selecting file system and mount point for logical volume (LV) home: from the following screen, select ext4 to be the file system for logical volume (LV) name “lv-home” and select partition “/home” to be the mount point for logical volume (LV) name “lv-home” as the following.
3. Selecting file system and mount point for logical volume (LV) root: from the following screen, select ext4 to be the file system for logical volume (LV) name “lv-root” and select partition “/” to be the mount point for logical volume (LV) name “lv-root” as the following.
4. Selecting file system and mount point for logical volume (LV) swap: from the following screen, select ext4 to be the file system for logical volume (LV) name “lv-swap” and select partition “swap area” to be the mount point for logical volume (LV) name “lv-swap” as the following.
5. Selecting file system and mount point for logical volume (LV) tmp: from the following screen, select ext4 to be the file system for logical volume (LV) name “lv-tmp” and select partition “/tmp” to be the mount point for logical volume (LV) name “lv-tmp” as the following.
6. Selecting file system and mount point for logical volume (LV) usr: from the following screen, select ext4 to be the file system for logical volume (LV) name “lv-usr” and select partition “/usr” to be the mount point for logical volume (LV) name “lv-usr” as the following.
7. Selecting file system and mount point for logical volume (LV) var: from the following screen, select ext4 to be the file system for logical volume (LV) name “lv-var” and select partition “/var” to be the mount point for logical volume (LV) name “lv-var” as the following.
Now we have already selected the file systems and mount points for each logical volume (LV). Select option “Finish partitioning and write change to disk” to finish partition disk step and starting to format those partitions.
Follow the on-screen options of the installation process until you reach at the following screen which is the last step. Select “Continue” as the following and press enter to restart the system.
7. Conclusion
You should now be able to to install any version Debian Operating System (OS) in with Logical Volume Manager. Sooner or latter, if one of the logical volumes created above running our of space or almost reaches its total disk space capacity, we can always increase easily without effecting the running applications and it is not required to reboot the system. If you have any questions or suggestions you can always leave your comments below. I will try all of my best to review and reply them.