LVM Basic Configuration
Primary checks
Log onto your server and check if
the disk is really empty
# fdisk -l
# pvdisplay
--- Physical volume
---
PV Name /dev/sda2
VG Name rootvg
PV Size 14.51 GB / not usable 1011.00 KB
Allocatable yes
PE Size (KByte) 4096
Total PE 3714
Free PE 2
Allocated PE 3712
PV UUID
BW0x8y-tZhN-X75D-khKB-4IF3-klRt-1W6jJu
lvm.conf filter
to ensure correct devices are selected with EMC powerpath setup lvm.conf filter like this :
filter = [ "a|/dev/emcpower*|", "r|/dev/dm*|", "r|/dev/sd*|", "r|/dev/mapper/*|", "r|/dev/mpath/*|", "r|/dev/.*/by-path/.*|", "r|/dev/.*/by-id/.*|", "a/.*/"]
otherwise , the system might pick up the native mpath rather than the emcpower device (which kinda defeats the purpose of using Powerpath)
With both checks you shouldn’t see any partitions on your
new disk! Otherwise stop here and ask!
Creation of the
Partition
# pvcreate /dev/sdb
No physical volume label read from /dev/sdb
Physical volume "/dev/sdb"
successfully created
“pvs”
and “pvdisplay” offer you possibilities to check the status
# pvs
PV
VG Fmt Attr PSize
PFree
/dev/sda2
rootvg lvm2 a- 14.51G 8.00M
/dev/sdb lvm2 -- 10.00G 10.00G
Creation of a VG
Your created PVs get bundled into one VG.
# vgcreate datavg /dev/sdb
Volume group "datavg" successfully
created
Use now "pvdisplay" to
show that your VG has been created
# pvdisplay
--- Physical volume ---
PV Name /dev/sdb
VG Name datavg
PV Size 10.00 GB / not usable 4.00 MB
Allocatable yes
PE Size (KByte) 4096
Total PE 2559
Free PE 2559
Allocated PE 0
PV UUID
Cmlxtp-A1Xt-Qizh-NPds-ofxj-riu0-NgbVbl
--- Physical volume ---
PV Name /dev/sda2
VG Name rootvg
PV Size 14.51 GB / not usable 1011.00 KB
Allocatable yes
PE Size (KByte) 4096
Total PE 3714
Free PE 2
Allocated PE 3712
PV UUID
AW0x8y-tZhN-X75D-khKB-4IF3-klRt-1W6jJu
Creation of LVs
Now for the creation of LVs there
are several possibilites.
lvcreate
-n datalv -L1G datavg
lvcreate
-n datalv -l100%VG datavg
lvcreate
-n datalv -l100%FREE datavg
We separate our volumegroup into two
different logical volumes with the same size
# lvcreate -n datalv -l50%VG datavg
Logical volume "datalv" created
# lvcreate -n appslv -l50%VG datavg
Logical volume "appslv" created
Check now with lvdisplay what you
did!
# lvdisplay /dev/datavg
--- Logical volume ---
LV Name /dev/datavg/datalv
VG Name datavg
LV UUID
IPUBp2-NfPA-vQkM-U9xD-2GW4-NuI7-E7TbX1
LV Write Access read/write
LV Status available
# open 0
LV Size 5.00 GB
Current LE 1279
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 1024
Block device 253:5
--- Logical volume ---
LV Name /dev/datavg/appslv
VG Name datavg
LV UUID
OPffwS-ZNrc-tU2G-ASqp-Ygj4-Yk7Q-ujrDM4
LV Write Access read/write
LV Status available
# open 0
LV Size 5.00 GB
Current LE 1279
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 1024
Block device 253:6
Creation of a
filesystem
You can now format you filesystem and
mount it
# mkfs.ext3
/dev/datavg/datalv
mkdir /data
mount dev/datavg/datalv /data
umount /data
add to /etc/fstab
dev/datavg/datalv /data ext3 defaults 1
2
mount -a