In the last post of AIX, I had explained that how we create a logical volume manager on AIX operating system. In this post, I will explain to you how to add a disk on AIX logical volume manager.
LVM (Logical Volume Manager) is a tool for logical volume management which includes allocating disks, striping, mirroring and resizing logical volumes.With LVM, a hard drive or set of hard drives is allocated to one or more physical volumes.
LVM allows users to create partitions from more than one disk and allows them to extend the filesystem size online within few seconds.
Step by step method to add a disk on LVM.
1. In the first step we will add the physical or virtual disk to the logical partition. Once the new disk is added on the logical partition then we can able to go for next step.
2. Now, rescan your system hardware so that the Operating system can find which new hard disk is add on the server. For this please use the below command to scan the hardware on AIX operating system.
aix:/> cfgmgr
3. In this step, we will check the disk. For example, let’s assume that the new disk is hdisk1, so please run the below command to check the disk.
aix:/> lsdev -Cc disk
hdisk0 Available Virtual SCSI Disk Drive
hdisk1 Available Virtual SCSI Disk Drive
aix:/> lspv
hdisk0 00f68f03d1e42951 rootvg active
hdisk1 00f68f03d20beafd vstorage active
hdisk2 00f68f03d20ceb37 vstorage active
if you see the above both output, you can found that hdisk1 is available to add on Voulme group.
4. In this step, now you need to create a new group and move the new disk hdisk1 in there. Let's assume the new group named is "rootvg". So please find the below command to create a new group and add the disk in it.
aix:/> mkvg -y rootvg hdisk1
5. Now you can look at the size of hdisk1. Please run the below command , you can found the below output regarding the disk space of your disk and this command would not work if it is not associated with the volume group.
aix:/> lspv hdisk1
PHYSICAL VOLUME: hdisk1 VOLUME GROUP: rootvg
PV IDENTIFIER: 00f68f03d1e42951 VG IDENTIFIER 00f68f0300004c0000000153d1e429c1
PV STATE: active
STALE PARTITIONS: 0 ALLOCATABLE: yes
PP SIZE: 128 megabyte(s) LOGICAL VOLUMES: 17
TOTAL PPs: 799 (102272 megabytes) VG DESCRIPTORS: 2
FREE PPs: 118 (15104 megabytes) HOT SPARE: no
USED PPs: 681 (87168 megabytes) MAX REQUEST: 256 kilobytes
FREE DISTRIBUTION: 11..00..00..00..107
USED DISTRIBUTION: 149..160..159..160..53
MIRROR POOL: None
6. In this step , now we will create a log logical volume for jfs2 file system and this needs to be part of vloume group "rootvg".
aix:/> mklv -t jfs2log rootvg 1
As i can not paste the my machine output as I am already add it, You can add at your end , if any issue occur on this stage please comment on the post.
7. Now, we will check the new logical volume (lv) and you can used the below command to check the new logical volume present on the AIX server.Normally on AIX server we are used "loglv00" logical name, as on my machine I used the same name.
aix:/> lsvg
rootvg
aix:/> lsvg -l rootvg
rootvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
hd5 boot 1 1 1 closed/syncd N/A
hd6 paging 404 404 1 open/syncd N/A
loglv00 jfs2log 1 1 1 open/syncd N/A
hd4 jfs2 4 4 1 open/syncd /
If you see the above both the output, you can find that "rootvg" is voulme group present and in rootvg, you can find the logical volume "loglv00".
8. In this, we will create a logical volume and fixed their size , lets assume we will used 30GB size and used the logical volume name lglv_test.
aix:/> lsvg rootvg
aix:/> mklv -t jfs2 -y lglv_test rootvg 30G
aix:/> mkfs -o log=/dev/loglv00 -V jfs2 /dev/lglv_test
9. In the seconf last step we will mount the newly created file system on the AIX operating system.
aix:/> mkdir /test
aix:/> mount -o log=/dev/loglv00 /dev/lglv_test /test
In this example , we will create a "/test" file system and mount the file system on this folder.
10. In the final step we will make a permament entry of this file system in "/etc/filesystems file so once you take a reboot of AIX server, file system will mount permamently, otherwise you need to mount again if you not made an entry in /etc/filesystems.
Hope this post is useful for you, as this step by step method you can not found in other sites, In case still you are facing any issue related to this topic, please comment on this post, I will revert to you with solution.