Tech Junkie Blog - Real World Tutorials, Happy Coding!: Linux Storage Management: Create Logical Volume Management (LVM) On Install

Monday, January 3, 2022

Linux Storage Management: Create Logical Volume Management (LVM) On Install

LVM in Linux allows multiple disks to be combined into one called logical volumes via software.  In this post we are going to create LVMs for a brand new system.  There are two scenarios, the first is LVM on a new system and the second scenario is to create LVM on an existing system.

I am going to create the new system on VirtualBox, I will not go through the process of create a new VM on VirtualBox because I've covered that in the past.  You can search for it on my site if you are lost.

Here are the steps to creating LVM during installation:

1.  On the first screen of installation select the first option

2. Select your language, then click "Continue"

3. On the "Installation Summary" screen click on "Network & Hostname"

4. Give your system a hostname and click "Apply", then click "Done"

5. Click on "Installation Destination"

6. Select disk on the screen and make sure you select "Custom

7. On the "Manual Partitioning" screen select LVM

8. Then click on the + sign
9. The first mount point you are going to create is the /boot mount point because it is required, but it doesn't require a lot of disk space, so we are going to allocate 500m.  A custom Logical Volume basically let's you divide the 8GB on the disk anyway you like instead of letting the operating system decide for you.  That's why most systems run out of disk space at the root level which is / because the operating system did not allocate enough space at installation. Click on "Add mount point" when done

10. On the confirmation screen reselect LVM on the drop down if Standard is selected, accept the default, notice now you only have 7.5GB of disk space left, that's because you allocated 500MB to the /boot mount.

11. Click on the + sign again, this time assign 2 GB to the /home mount, follow the steps above to create the /home mount point with 2 GB

12. Repeat the steps for /var and allocate 2 GB to it and the mount swap with 1 GB, your screen should look like the following when you are finished

13.  You should be left with about 3 GB of disk space left, the best thing we can do right now is to assign it to the root / mount so that we are using all the capacity of the disk.  To do that click on the + sign again, select / from the mount dropdown and type all in the "Desired Capacity" field, then click on the "Add mount point" button

Your screen should look like the following when you are done, click "Done"

Error checking will be performed and a message will pop up telling you to click "Done" again.  "Accept Changes"

14.  While Error checking is performed on the disk, create a root password by clicking on "Root Password" follow the direction to create a root password

15. For Error checking, it says that /boot cannot be LVM so change it to Standard

Note: I had to add a bigger disk on VirtualBox because apparently CentOS required more disk space for installation.  It would not pass the installation requirements, so I used a 25 GB disk.  But the instructions should be the same.

16.  Once the root password has been created click on the "Begin Installation" button.

17.  This step is going to take awhile.

18.  Once installation is complete remove the installation media and click on "Reboot System"

19. On reboot for the first time you will be asked to create a new user, that's up to you.  I usually create one just for convenience.  If you don't want to create a user just accept the license and click "Finish Configuration"

20. Once you completed the configuration steps and logged in, type df -h in the terminal and you will see that the disk's setup is as you specified in your installation

No comments:

Post a Comment

Search This Blog