0% found this document useful (0 votes)
15 views

Admin2 Day4

This document discusses managing logical volumes using LVM. It covers: 1. Creating a volume group from physical volumes and then creating a logical volume within that volume group. 2. Extending the size of a logical volume by first extending the volume group with an additional physical volume, then resizing the logical volume. 3. Reducing the size of a logical volume by first unmounting, checking and resizing the file system, then reducing the logical volume size.

Uploaded by

MOFEED AFANDI
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Admin2 Day4

This document discusses managing logical volumes using LVM. It covers: 1. Creating a volume group from physical volumes and then creating a logical volume within that volume group. 2. Extending the size of a logical volume by first extending the volume group with an additional physical volume, then resizing the logical volume. 3. Reducing the size of a logical volume by first unmounting, checking and resizing the file system, then reducing the logical volume size.

Uploaded by

MOFEED AFANDI
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Manage logical volumes LVM

Partitioning fdisk LVM


1- LVM support Online Resizing
2- LVM support Storage Pool " Volume Group "
3- Eazy to manage

fdisk support boot , Store data


LVM store data only
---------------------------------------------------------
Physical Volume PV
Volume Group VG
Logical Volume LV

## Create and List LVM


# pvcreate /dev/nvme0n3 /dev/nvme0n4
# pvs
# vgcreate vg0 /dev/nvme0n3 /dev/nvme0n4
# vgs
# lvcreate --name lv0 --size 120G vg0
# lvs
# mkfs.ext4 /dev/vg0/lv0
# mkdir /mount100
# mount /dev/vg0/lv0 /mount100/
# df -hT /mount100/
# df -hT
# vim /etc/fstab
# mount -a
--------------------------------------------------------
## Extend Logical Volume
- we need to extend logical volume to 250 GB - VG0 200 GB - 1st extend Volume
Group

# pvcreate /dev/nvme0n5
# vgextend vg0 /dev/nvme0n5
# vgs
# lvextend vg0/lv0 --size 250G
# resize2fs /dev/vg0/lv0
----------------------------------------------------------
## Reduce Logical Volume " shrink Size " 170 GB
umount - file system check - resize file system - lvreduce

# umount /mount100
# e2fsck -f /dev/vg0/lv0
# resize2fs /dev/vg0/lv0 170G
# lvreduce vg0/lv0 --size 170G
# lvs
# mount -a
# df -hT /mount100/

-----------------------------------------------------------
## Remove Logical Volume
# umount /mount100
# vim /etc/fstab remove mount lines
# lvremove vg0/lv0
# vgremove vg0
# pvremove /dev/nvme0n3 /dev/nvme0n4 /dev/nvme0n5
###################################################################################
##################

You might also like