linux configure LVM

1. Ali cloud mount LVM directory (create LVM, and configuring the first hard disk)

fdisk /dev/vdb


Entry

n

p

1

enter

enter

wq

pvcreate /dev/vdb1
vgcreate lvmgroup /dev/vdb1
vgchange -ay lvmgroup
lvcreate -l 100%FREE -n elasticsearch lvmgroup
fdisk -l
mkfs.ext4 /dev/mapper/lvmgroup-elasticsearch 
cd /
mkdir elasticsearch
mount /dev/mapper/lvmgroup-elasticsearch /elasticsearch/
df -h

The new LVM partition mounted onto a directory, and set the boot automatically mount

we / etc / fstab

The following words into the bottom fstab

"/dev/mapper/lvmgroup-elasticsearch /elasticsearch ext4 defaults 0 0"

2. expand new hard disk partition on an existing LVM

Hanging in the new hard disk

fdisk -l
fdisk /dev/vdd

Entry

n

p

1

Enter

Enter

t

8e

wq

pvcreate /dev/vdd1
vgextend lvmgroup /dev/vdd1
lvextend -l +100%free /dev/mapper/lvmgroup-elasticsearch
resize2fs /dev/mapper/lvmgroup-elasticsearch

 

Guess you like

Origin www.cnblogs.com/faberbeta/p/linux-shell015.html
LVM