AIX Creating a Volume Group
Creating a Volume Group
This post will describe how to:
1. Create a Volume Group
2. Create a Logical Volume within the VG containing a JFS2 filesystem that will be automatically mounted during boot.
3. Add a disk to the VG and mirror the data across 2 disks
4. Display LP>PP mappig and LVCB
1. Create a VG
# mkvg -y vg0 -s64 -V99 hdisk3 vg0
-y VG name
-s PP size
-V VG Major Number
Now lets’ display which PV belongs to which VG and their status
# lspv hdisk0 00c0e90dce6c290a rootvg active hdisk1 00cf405ea5c630a9 rootvg active hdisk3 00cf405ea25a9e70 vg0 active hdisk4 00cf405ea25a9f84 None hdisk5 00cf405ea5ce7f72 None hdisk6 00cf405ea5ce8085 None
2. Create a Logical Volume with a JFS2 Filesystem that will be automatically mounted on the /store mountpoint.
# crfs -v jfs2 -A yes -g vg0 -m /store -a size=1G File system created successfully. 1048340 kilobytes total disk space. New File System size is 2097152
-v Filesystem type
-A Automount at boot
-g VG in which the LV will reside
-m mount point
# mount /store # df -g /store Filesystem GB blocks Free %Used Iused %Iused Mounted on /dev/fslv07 1.00 1.00 1% 4 1% /store
3. Add a disk to the VG and mirror the data
# extendvg vg0 hdisk4 # mirrorvg -m vg0 hdisk4 0516-1804 chvg: The quorum change takes effect immediately.
-m Exact mapping of PP’s on both PV’s
# lslv fslv07 | grep LP MAX LPs: 512 PP SIZE: 64 megabyte(s) LPs: 16 PPs: 32 EACH LP COPY ON A SEPARATE PV ?: yes
The lslv command shows that we have 16 Logical Partitions stored on 32 Physical Partitions.
4. LP > PP mapping
# lsvg -M vg0 vg0 hdisk3:1-7 hdisk3:8 loglv01:1:1 hdisk3:9 fslv07:1:1 hdisk3:10 fslv07:2:1 hdisk3:11 fslv07:3:1 hdisk3:12 fslv07:4:1 hdisk3:13 fslv07:5:1 hdisk3:14 fslv07:6:1 hdisk3:15 fslv07:7:1 hdisk3:16 fslv07:8:1 hdisk3:17 fslv07:9:1 hdisk3:18 fslv07:10:1 hdisk3:19 fslv07:11:1 hdisk3:20 fslv07:12:1 hdisk3:21 fslv07:13:1 hdisk3:22 fslv07:14:1 hdisk3:23 fslv07:15:1 hdisk3:24 fslv07:16:1 hdisk3:25-31 hdisk4:1-7 hdisk4:8 loglv01:1:2 hdisk4:9 fslv07:1:2 hdisk4:10 fslv07:2:2 hdisk4:11 fslv07:3:2 hdisk4:12 fslv07:4:2 hdisk4:13 fslv07:5:2 hdisk4:14 fslv07:6:2 hdisk4:15 fslv07:7:2 hdisk4:16 fslv07:8:2 hdisk4:17 fslv07:9:2 hdisk4:18 fslv07:10:2 hdisk4:19 fslv07:11:2 hdisk4:20 fslv07:12:2 hdisk4:21 fslv07:13:2 hdisk4:22 fslv07:14:2 hdisk4:23 fslv07:15:2 hdisk4:24 fslv07:16:2 hdisk4:25-31
The lsvg command shows the mapping (-M) of the hdisk’s Physical Partitions to the Logical Partition’s of the Logical Volume fslv07 in the following format.
Disk Name. LV Name hdisk4:9 fslv07:1:2 -- Logical Partition copy Number 2 | | Physical Partition 9 | Logical Partition 1
So we can see from this line, that the second copy of the Logical Partition no. 1 of the Logical Volume fslv07 resides on the Physical Partition no. 9 of hdisk4.
Another possibility is to display the mapping on a LV level using the lslv command.
# lslv -m fslv07 fslv07:/store LP PP1 PV1 PP2 PV2 PP3 PV3 0001 0009 hdisk3 0009 hdisk4 0002 0010 hdisk3 0010 hdisk4 0003 0011 hdisk3 0011 hdisk4 0004 0012 hdisk3 0012 hdisk4 0005 0013 hdisk3 0013 hdisk4 0006 0014 hdisk3 0014 hdisk4 0007 0015 hdisk3 0015 hdisk4 0008 0016 hdisk3 0016 hdisk4 0009 0017 hdisk3 0017 hdisk4 0010 0018 hdisk3 0018 hdisk4 0011 0019 hdisk3 0019 hdisk4 0012 0020 hdisk3 0020 hdisk4 0013 0021 hdisk3 0021 hdisk4 0014 0022 hdisk3 0022 hdisk4 0015 0023 hdisk3 0023 hdisk4 0016 0024 hdisk3 0024 hdisk4
To display the Logical Volume Control Block of the specified LV type:
# getlvcb -AT fslv07 AIX LVCB intrapolicy = m copies = 2 interpolicy = m lvid = 00cf405e00004c0000000135e3e508e9.2 lvname = fslv07 label = /store machine id = xxxxxxxxx number lps = 16 relocatable = y strict = y stripe width = 0 stripe size in exponent = 0 type = jfs2 upperbound = 32 fs = vfs=jfs2:log=/dev/loglv01:mount=true:account=false time created = Mon Mar 5 17:30:29 2012 time modified = Mon Mar 5 17:42:04 2012