Last active
March 21, 2020 16:53
-
-
Save payamomrani/ca2e66dc8f520e5cbec81c28442da5c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yum install lvm2 | |
//Add new Physical drive | |
fdisk -l | |
//detect Physicls like /dev/vdb or /dev/sdb and create new Physical Volume(PV) | |
pvcreate /dev/sda /dev/sdb | |
pvdisplay | |
//Create New Volume Group(VG) | |
vgcreate vg_server /dev/sda /dev/sdb | |
vgdisplay vg_server | |
//When add another physicaly drive | |
pvcreate /dev/sdd | |
vgextend vg_server /dev/sdd | |
//Create new Logical Volume | |
lvcreate -L 1G -n Vol01 vg_server | |
lvdisplay vg_server | |
//Format lv | |
mkfs -t ext4 /dev/vg_server/vol01 | |
//mount lv | |
mount /dev/vg_server/vol01 /mnt | |
//for change lv size | |
lvextend -L +800 /dev/vg_server/vol01 | |
resize2fs /dev/vg_server/vol01 | |
//remove lv | |
lvremove /dev/vg_server/vol01 | |
//remove vg | |
vgremove vg_server | |
//Remve PV From VG | |
vgreduce vg_server /dev/sdb | |
//Remove PV | |
pvremove /dev/sdb | |
//Add Mount to etc/fstab | |
/dev/vg_server/Home /home ext4 defaults 0 0 | |
http://linuxihaa.ir/lvm/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment