189. LVM Configuration During Installation (CentOS) π½
Table of Contents π
- Overview of LVM (Logical Volume Management) π‘
- Steps to Configure LVM During CentOS Installation π₯οΈ
- 1. Start CentOS Installation π
- 2. Select Installation Destination π
- 3. Choose LVM for Partitioning βοΈ
- 4. Create a Volume Group (VG) ποΈ
- 5. Create Logical Volumes (LVs) π
- 6. Allocate Physical Volumes (PVs) π
- 7. Configure Filesystem for Each Logical Volume π
- 8. Configure Swap Partition π
- 9. Save the Configuration and Proceed with Installation β
- Example Configuration for CentOS LVM Layout π§
- Post-Installation LVM Management π οΈ
- Benefits of LVM π―
1. Overview of LVM (Logical Volume Management) π‘
LVM (Logical Volume Management) is a powerful disk management tool in Linux that allows flexible and dynamic management of disk space. It lets you resize, add, or remove partitions without downtime, making it easier to handle growing storage needs. π οΈ
2. Steps to Configure LVM During CentOS Installation π₯οΈ
1. Start CentOS Installation π
- Boot the system using the CentOS Installation Media (DVD/USB).
- Proceed through the initial steps of installation until you reach the Installation Destination screen.
2. Select Installation Destination π
- On the Installation Destination screen, select the disk to install CentOS.
- Choose Custom under Storage Configuration to configure partitions manually using LVM. π οΈ
3. Choose LVM for Partitioning βοΈ
- In the partitioning section, click Create automatically to let the system create default partitions.
- Alternatively, manually create partitions and set the Device Type to LVM for each partition. This configures your partitions as logical volumes (LVs). π
4. Create a Volume Group (VG) ποΈ
- A Volume Group (VG) is a collection of one or more physical volumes (PVs). To create a VG:
- Click the Volume Group button.
- Name the volume group (e.g.,
vg_centos
). - Select the disks or physical volumes you want to include in the VG.
- Click Save to complete the VG setup.
5. Create Logical Volumes (LVs) π
- Logical Volumes (LVs) are the partitions created within a volume group. For each partition:
- Click the + button to add a new mount point (e.g.,
/
,/home
,/var
,swap
). - Set the Device Type to LVM and assign the mount point.
- Allocate the size for each LV.
- Repeat this process for all necessary partitions.
6. Allocate Physical Volumes (PVs) π
- Physical Volumes (PVs) are the actual disk partitions or entire disks that form the base of the LVM hierarchy.
- Select the disks and allocate space as Physical Volume for LVM. π
- These physical volumes will be grouped into the Volume Group created in the previous step.
7. Configure Filesystem for Each Logical Volume π
- For each logical volume (LV), assign the appropriate filesystem type:
/boot
: Usually ext4 or XFS (not part of LVM)./
: XFS (default filesystem in CentOS 7 and above)./home
: XFS./var
: XFS or ext4.- Ensure each LV has the correct mount point and size for your needs.
8. Configure Swap Partition π
- Create a swap partition as a logical volume within the volume group:
- Choose LVM and assign the mount point as
swap
. - Size it based on your system's RAM (typically 1.5x or 2x your physical memory). π
9. Save the Configuration and Proceed with Installation β
- After setting up the LVM configuration, click Done.
- Review the summary of partitions and proceed with the installation if everything is correct. π¦
Example Configuration for CentOS LVM Layout π§
Hereβs an example of how you might configure an LVM layout:
Mount Point | Logical Volume Name | Size | Filesystem Type | Volume Group |
---|---|---|---|---|
/boot |
(Not under LVM) | 1GB | ext4 | N/A |
/ |
lv_root | 30GB | XFS | vg_centos |
/home |
lv_home | 50GB | XFS | vg_centos |
/var |
lv_var | 10GB | XFS | vg_centos |
swap |
lv_swap | 4GB | swap | vg_centos |
Post-Installation LVM Management π οΈ
LVM offers flexibility for managing storage after installation. Some useful commands include:
- Extend a Logical Volume:
Followed by resizing the filesystem:
- Create a Snapshot:
Benefits of LVM π―
- Flexibility: Resize partitions dynamically, without needing to reboot the system. π
- Snapshots: Create snapshots of logical volumes for backup or testing purposes. ποΈ
- Disk Management: Easily add new disks to extend existing volume groups. π οΈ
By configuring LVM during CentOS installation, you ensure a flexible and scalable disk management system that can adapt to your growing storage needs without requiring downtime! π