- 8777701917
- info@saikatinfotech.com
- Basirhat W.B
LVM (Logical Volume Management) is a flexible and powerful system for managing disk storage in Linux. It allows administrators to create, resize, and manage storage volumes more easily and dynamically than with traditional partitioning schemes. LVM provides abstraction layers between the physical storage (like hard drives or SSDs) and the logical volumes that the operating system and applications use.
LVM works by creating logical volumes (LVs) that can span across multiple physical disks, allowing for easy resizing and reorganization of storage as needed. The main components in an LVM setup are:
Physical Volume (PV):
/dev/sda
) or a partition (e.g., /dev/sda1
).Volume Group (VG):
Logical Volume (LV):
Physical Extents (PE):
Logical Extents (LE):
Dynamic Volume Resizing:
Disk Pooling:
/dev/sda
, /dev/sdb
, /dev/sdc
) into one larger storage space, which simplifies management.Snapshot Support:
Flexibility:
Improved Data Management:
RAID-like Functionality:
Commnd Start
1.sudo fdisk -l : find new drive
or lsblk or df -h
2.sudo pvscan
3.sudo fdisk /dev/sdb
n
p
1
[enter]
[enter]
t
8e
w
5.lsblk and see /dev/sdb1 added
if /dev/sdb1 is not seen then reboot before continuing further
5.lsblk and see /dev/sdb1 added
if /dev/sdb1 is not seen then reboot before continuing further
1 – pvcreate /dev/sdb1 <create a LVM physical volume on the partition we just created>
pvdisplay <Checking Commnd>
Vg Create Commnd
Create volume Group
2 – vgcreate vgapps /dev/sdb1 /dev/sdb2
Lv Create Commnd
lvcreate -L 1G -n app1-lv vgapps
lvcreate -L 1G -n app2-lv vgapps
lvdisplay <Checking LV Create Or Not>
Formating Commnd
mkfs.ext4 /dev/vgapps/app1-lv
Create a mount point and then mount the volume somewhere you can use it.
5 – mkdir /mnt/app1
6 mount /dev/vgapps/app1-lv /mnt/app1
Checking All HDD Disk Space Commnd – df -th
HDD Add to Fstab Configuration
cat /etc/mtab
Space Extend
Add New HDD Disk Then Follow Step
fdisk /dev/sdc
n = create new partition
p = creates primary partition
1 = makes partition the first on the disk
t = change partition type
8e = changes to LVM partition type
p = view partition setup so we can review before writing changes to disk
w = write changes to disk
pvcreate /dev/sdbc <create a LVM physical volume on the partition we just created>
6 – vgextend vgapps /dev/sdc1
Extend Logical Volume
7 – lvextend -L +1G /dev/vgapps/app1-lv
8 – resize2fs /dev/vgapps/app1-lv
How To Cheking Linux Ubantu Disk Status
lsblk
fdisk -l
df -hT
lsblk -f <Cheking Formating Partition >
mount -av <cheking Mounting>
How To Create Linux Ubantu LVM
Step#01 fdisk /dev/sdb <Go To HDD >
Step#02 n, p, t, 8e, w <New Partion Create>
Step#03 partprobe /dev/sdb <Karnel Infom For New HDD Partition>
Step#04 pvcreate /dev/sdb1 <Create Pv>
Step#05 vgcreate nextcloud /dev/sdb1 <Create VG>
Step#06 lvcreate -L 500G -n nextcloud nextcloudlv <Create LV>
Step#07 mkfs.ext4 /dev/mapper/nextcloud-nextcloudlv <Formating>
Step#08 mount /dev/mapper/nextcloud-nextcloudlv /var/www/html <Create Mount Point For Use Disk Space>
Step#09 df -hT <For Checking Mount>
Step#10 cat/etc/mtab <Copy Full Path nextcloud-nextcloudlv For Entry Fstab>
Step#11 nano /etc/fstab
Step#12 /dev/mapper/nextcloud-nextcloudlv /var/www/html ext4 errors=remount-ro 0 1 <Paste This Line Fstab Then Save
How To Cheking Linux Ubantu LVM Status
pvdisplay
vgdisplay
lvdisplay
lvs
vgs
pvs
lvscan
pvscan
vgscan
How To Remove Linux Ubantu LVM
lvremove /dev/nextcloud/nextcloudlv
How to vgextended Commnd
vgextend vgapps /dev/sdc1
Extend Logical Volume
lvextend -L +1G /dev/vgapps/app1-lv
resize2fs /dev/vgapps/app1-lv