Logical Volume Manager (LVM) of MultiPath Block Storage
01.00. Attached Block Storage Device:
01.01. Check the attached block storage device on the host.
lsblk
If we can see the mpathX, where X = a, b, c etc. our block storage device provides by multipath channel. In that case we also check by- 'multipath -l' or 'multipath -ll' command.
01.02. Now check the mpathX block storage device and its associated representator disk.
sdb 8:16 0 600G 0 disk
└─mpatha 253:5 0 600G 0 mpath
sdc 8:32 0 600G 0 disk
└─mpathb 253:6 0 600G 0 mpath
sdd 8:48 0 600G 0 disk
└─mpathc 253:7 0 600G 0 mpath
sde 8:64 0 1T 0 disk
└─mpathd 253:8 0 1T 0 mpath
sdf 8:80 0 400G 0 disk
└─mpathe 253:10 0 400G 0 mpath
sdg 8:96 0 1T 0 disk
└─mpathf 253:12 0 1T 0 mpath
sdh 8:112 0 1T 0 disk
└─mpathd 253:8 0 1T 0 mpath
sdi 8:128 0 400G 0 disk
└─mpathe 253:10 0 400G 0 mpath
sdj 8:144 0 1T 0 disk
└─mpathf 253:12 0 1T 0 mpath
sdk 8:160 0 600G 0 disk
└─mpatha 253:5 0 600G 0 mpath
sdl 8:176 0 600G 0 disk
└─mpathb 253:6 0 600G 0 mpath
sdm 8:192 0 600G 0 disk
└─mpathc 253:7 0 600G 0 mpath
In that case, mpatha associated to sdb.
So, in the views of multipath our total diak and size will be.
fdisk /dev/mapper/mpatha size=600G
fdisk /dev/mapper/mpathb size=600G
fdisk /dev/mapper/mpathc size=600G
fdisk /dev/mapper/mpathd size=1.0T
fdisk /dev/mapper/mpathe size=400G
fdisk /dev/mapper/mpathf size=1.0T
02.00. Format the disk.
02.01. In that case, the attached block storage device is connected through multipath, so we use 'fdisk /dev/mapper/mpathX' command to format the disk.
fdisk /dev/mapper/mpatha -> p -> n -> Three Enter -> [Y] -> p -> t -> 8e -> Enter -> p -> w
fdisk /dev/mapper/mpathb -> p -> n -> Three Enter -> [Y] -> p -> t -> 8e -> Enter -> p -> w
fdisk /dev/mapper/mpathc -> p -> n -> Three Enter -> [Y] -> p -> t -> 8e -> Enter -> p -> w
fdisk /dev/mapper/mpathd -> p -> n -> Three Enter -> [Y] -> p -> t -> 8e -> Enter -> p -> w
fdisk /dev/mapper/mpathe -> p -> n -> Three Enter -> [Y] -> p -> t -> 8e -> Enter -> p -> w
fdisk /dev/mapper/mpathf -> p -> n -> Three Enter -> [Y] -> p -> t -> 8e -> Enter -> p -> w
In that workflow, we create a primary Linux LVM partition;
/dev/mapper/mpatha-part1 4096 1258291199 1258287104 600G 8e Linux LVM
/dev/mapper/mpathb-part1 4096 1258291199 1258287104 600G 8e Linux LVM
/dev/mapper/mpathc-part1 4096 1258291199 1258287104 600G 8e Linux LVM
/dev/mapper/mpathd-part1 4096 2147483647 2147479552 1024G 8e Linux LVM
/dev/mapper/mpathe-part1 4096 838860799 838856704 400G 8e Linux LVM
/dev/mapper/mpathf-part1 4096 2147483647 2147479552 1024G 8e Linux LVM
02.02. Enter the below command to commit all changes on run time.
partprobe
02.03. Check the formated disk.
blkid
/dev/mapper/mpatha: PTUUID="4302be30" PTTYPE="dos"
/dev/mapper/mpathb: PTUUID="a84320d1" PTTYPE="dos"
/dev/mapper/mpathc: PTUUID="b2e72e21" PTTYPE="dos"
/dev/mapper/mpathd: PTUUID="aacb7071" PTTYPE="dos"
/dev/mapper/mpathe: PTUUID="f743f2b8" PTTYPE="dos"
/dev/mapper/mpathf: PTUUID="63ba010e" PTTYPE="dos"
/dev/mapper/mpatha1: PARTUUID="4302be30-01"
/dev/mapper/mpathb1: PARTUUID="a84320d1-01"
/dev/mapper/mpathc1: PARTUUID="b2e72e21-01"
/dev/mapper/mpathd1: PARTUUID="aacb7071-01"
/dev/mapper/mpathe1: PARTUUID="f743f2b8-01"
/dev/mapper/mpathf1: PARTUUID="63ba010e-01"
Here, '/dev/mapper/mpatha1' is the formated partition of the block storage '/dev/mapper/mpatha'.
03.00. Create Physical Volume:
pvcreate [/partitin/of_the/disk]
Create physical volume using the above patrition.
pvcreate /dev/mapper/mpatha1
Physical volume "/dev/mapper/mpatha1" successfully created.
pvcreate /dev/mapper/mpathb1
Physical volume "/dev/mapper/mpathb1" successfully created.
pvcreate /dev/mapper/mpathc1
Physical volume "/dev/mapper/mpathc1" successfully created.
pvcreate /dev/mapper/mpathd1
Physical volume "/dev/mapper/mpathd1" successfully created.
pvcreate /dev/mapper/mpathe1
Physical volume "/dev/mapper/mpathe1" successfully created.
pvcreate /dev/mapper/mpathf1
Physical volume "/dev/mapper/mpathf1" successfully created.
04.00. Create Volume Group:
vgcreate [vg_name] [physical_volume_path]
vgcreate vg_u01 /dev/mapper/mpatha1
Volume group "vg_u01" successfully created
05.00. Extend Volume Group:
We want to make a single mount point. So, we increase Volume group "vg_u01" by all our remaining Physical Volume.
vgextend [vg_name] [physical_volume_path]
vgextend vg_u01 /dev/mapper/mpathb1
Volume group "vg_u01" successfully extended
vgextend vg_u01 /dev/mapper/mpathc1
Volume group "vg_u01" successfully extended
vgextend vg_u01 /dev/mapper/mpathd1
Volume group "vg_u01" successfully extended
vgextend vg_u01 /dev/mapper/mpathe1
Volume group "vg_u01" successfully extended
vgextend vg_u01 /dev/mapper/mpathf1
Volume group "vg_u01" successfully extended
06.00. Create Logical Volume:
lvcreate -l 100%VG -n [lv_name] [vg_name]
lvcreate -l 100%VG -n lv_u01 vg_u01
WARNING: xfs signature detected on /dev/vg_u01/lv_u01 at offset 0. Wipe it? [y/n]: y
Wiping xfs signature on /dev/vg_u01/lv_u01.
Logical volume "lv_u01" created.
07.00. Create File System:
We want to create xfs file system.
mkfs.xfs /dev/vg_name/lvname
mkfs.xfs /dev/vg_u01/lv_u01
meta-data=/dev/vg_u01/lv_u01 isize=512 agcount=32, agsize=34799616 blks
= sectsz=4096 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1 bigtime=0 inobtcount=0
data = bsize=4096 blocks=1113581568, imaxpct=5
= sunit=512 swidth=512 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=521728, version=2
= sectsz=4096 sunit=1 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
Discarding blocks...Done.
08.00. Check the UUID:
blkid
/dev/mapper/vg_u01-lv_u01: UUID="e99622bc-aa32-4a88-a4b5-70a17668d0db" BLOCK_SIZE="4096" TYPE="xfs"
09.00. Mount to a Directory:
09.01. Create a directory.
mkdir /u01
09.02. Append the below line to '/etc/fstab' file.
tee -a /etc/fstab >/dev/null <<'EOF'
UUID=e99622bc-aa32-4a88-a4b5-70a17668d0db /u01 xfs defaults,_netdev 0 0
EOF
09.03. mount file system to directory.
mount -a
and check the direcroty size.
df -h
/dev/mapper/vg_u01-lv_u01 4.2T 30G 4.2T 1% /u01
10.00. Done for today!
Comments
Post a Comment