dropdown menu

PV

PV (Physical Volume)

When a disk drive is initially added to the system it is not yet accessible for operations. To be made accessible, it has to be assigned to a volume group, which means changing from a disk to a physical volume. The disk drive is assigned an identifier that is called the physical volume identifier (PVID).

The PVID is a combination of the machine's serial number and the date the PVID was generated and it is written on the first block of the device. The AIX LVM uses this number to identify specific disks. When a volume group is created, the member devices are simply a list of PVIDs.

The PVID for each device is stored in the ODM when the device is configured. The configuration program tries to read the first block of the device. If it succeeds and the first block contains a valid PVID, the PVID value is saved as an attribute in the ODM for that device. Once the PVID is set in the ODM, it can be seen in the output of the lspv command. (The LVM expects the PVIDs to be saved in the ODM, and it uses the ODM attribute when determining which device to open.)

In a configuration with multiple paths to the same logical devices, multiple hdisks show the same PVID in the output of lspv. When the LVM needs to open a device, it selects the first hdisk in the list with the matching PVID.

-----------------------------

Physical Volume states (not device states!):

active  - If a disk can be accessed during a varyonvg it gets a PV state of active.

missing - If a disk can not be accessed during a varyonvg, but quorum is available the failing disk gets a PV state missing.
          (after repairing it varyonvg wil bring it to active state)

removed - If a disk cannot be accessed during a varyonvg and the quorum of disks is not available you can issue varyonvg -f VGname
          (Before varyonvg -f always check the reason of the failure. If the pv appears to be permanently damaged use a forced varyonvg.)
          All physical volumes that are missing during this forced vary on will be changed to physical volume state removed.
          This means that all the VGDA and VGSA copies will be removed from these physical volumes.
          (After repiring the disk, first chpv -va diskname, it will bring back to active state and then varyonvg is needed for sync.)

The opposite of chpv -va is chpv -vr which brings the disk into the removed state. This works only when all logical volumes have been closed on the disk that will be defined as removed. Additionally, chpv -vr does not work when the quorum will be lost in the volume group after removing the disk

------------------------------


lsdev -Pc disk               displays supported storage
chdev -l hdisk7 -a pv=yes    changes disk device to a phys. volume by assigning a PVID (if disk is already a phys. volume does nothing)
chdev -l hdisk7 -a pv=clear  clears the PVID from the physical volume
chdev -l hdiskX -a queue_depth=32 -U  change attribute concurrently (only if lsattr -El hdiskX shows True+ for attr.)

lspv                      displays all physical volumes (vpath, hdisk), their PVIDs, their volume groups...
lspv hdisk0               detailed information about a phys. vol. (vg, pp size, free pp, logical volumes number)
lspv -l hdisk1            list of all the logical volumes on the physical volume
lspv -p hdisk2            displays a map of all physical partitions located on hdisk1
lspv -M hdisk1            shows which physical partitions are being used for specific logical volumes

bootinfo -s hdisk0        shows the size of a pv in MB

chpv -vr hdisk3           makes hdisk3 unavailable (pv state will be removed)
chpv -va hdisk3           makes hdisk3 available
chpv -c hdisk1            clears the bootrecord on hdisk1

The allocation permission for a physical volume determines if physical partitions located on that physical volume, which have not been allocated to a logical volume yet, can be allocated to logical volumes:
chpv -ay hdisk2           turns on the allocation permission
chpv -an hdisk2           turns off the allocation permission

migratepv hdisk1 hdisk5   migrates the data from hdisk1 to hdisk5 (moves all lvs, it can be done during normal system activity)
migratepv -l testlv hdisk1 hdisk5 migrates only testlv from hdisk1 to hdisk5

migratelp testlv/1/2 hdisk5/123 migrates the data from the second copy of the lp number 1 of lv to hdisk5 on pp 123
!!!check if lvmstat is enabled before running migratepv, migratelp, reorgvg, the command to check:lvmstat -v <vgname>!!!!
!!!because if it is, the system may crash, so before running those commands disable it: lvmstat -v <vgname> -d !!!!

lquerypv -h /dev/hdiskX   shows the disk header
lquerypv -M hdisk0        shows the LTG size for a physical disk
LTG size: Logical track group size is the maximum allowed transfer size for an I/O disk operation.

replacepv hdisk1 hdisk6   replace physical volume hdisk1 to hdisk6

mkdev -c disk -t 1200mb -s scsi -p scsi0 -w 6,0 -d creates a dummy hdisk (if it is needed to correct the sequence numbers)
mkdev -l hdiskX -p dummy -c disk -t hdisk -w 0000  the same as above (will give error, but creates it)

------------------------------

SAVING DISK HEADER:
at offset 128 the pvid starts.

To prevent a loss of the first 512 byte of the raw disk ( if something goes wrong with the chdev) use the following command to save
the current state of the sector “dd if=/dev/hdiskX of=hdiskX.header bs=512 count=1” if a command overwrites this sector you can
restore this sector with “dd if=hdiskX.header of=/dev/hdiskX bs=512 count=1” but if you make the copy be shure that the asm is
stopped, because the asm could make updates in this sector during shutdown.

------------------------------

Migrating a partition to another disk:

1.root@aix1: /root # lspv -M hdisk2
    hdisk2:1-14
    hdisk2:15       bblv1:1:1
    hdisk2:16       bblv1:2:1
    hdisk2:17       bblv1:3:1    <--we want to move bblv1:number 3 lp: first copy (the lv is mirrored, second copy is on another disk)
    hdisk2:18-67
2.root@aix1: /root # lspv -M hdisk4
    hdisk4:1-14
    hdisk4:15       loglv00:1
    hdisk4:16-67                 <--we want to move it to hdisk4 on physical partition 16
3.root@aix1: /root # migratelp bblv1/3/1 hdisk4/16
    migratelp: Mirror copy 1 of logical partition 3 of logical volume
      bblv1 migrated to physical partition 16 of hdisk4.
4.root@aix1: /root # lspv -M hdisk2
    hdisk2:1-14
    hdisk2:15       bblv1:1:1
    hdisk2:16       bblv1:2:1
    hdisk2:17-67                  <--physical partition 17 is free now
5.root@aix1: /root # lspv -M hdisk4
    hdisk4:1-14
    hdisk4:15       loglv00:1
    hdisk4:16       bblv1:3:1     <--it is here now
    hdisk4:17-67

21 comments:

Siva said...

Hi,

What is the difference between lun_id and unqiue_id in the $lsattr -El hdiskxx output

Regards,
Siva

aix said...

Hi,
LUN ID: It will be used together with the SCSI ID when sending and receiving SCSI commands.
Unique Device Identifier: This is a combination of product ID, manufacturer ID and serial number.

Siva said...

Hi,

Thanks, In the same, which ID is used to represent SAN LUN.

Regards,
Siva

aix said...

Hi, usually you get that type of LUN ID, depending from you storage driver, with a storage specific command. For example on EMC disks, powermt display dev=all will show that necessary ID.

Anonymous said...

hi
thanks for nice post
i ran the command mkdev -c disk -t 1200mb -s scsi -p scsi0 -w 6,0 -d and mkdev -l hdiskX -p dummy -c disk -t hdisk -w 0000 on aix71 but none of them worked!is it a trick or something for that?
thanks

Anonymous said...

Maybe just for completion there is also getconf as in:

getconf DISK_SIZE

just in case you think there aren't enough options available :-)

mmjaboor said...

how can i display the space utilization of PV (used & free) without multiplication pp size and pp number

Unknown said...

Hi, in addition to "lsdev -Pc disk" I would also use "lsdev -Cc disk" to list all devices of class "disk". The "lsdev -Pc disk" command only shows available disk device drivers and not the actual disk names that you will use to change into PVs ( "chdev -l hdisk7 -a pv=yes" ). I'm a correct?

idaho06 said...

In order to refresh the PVID, I ran "chdev -l hdiskpowerxx -a pv=yes" in a VIO with powerpath over a hdiskpower assigned to a LPAR. The LPAR froze and the disk assignment got lost. I had to reboot the VIO to recover production.

Anonymous said...

bootinfo -s hdisk0

Anonymous said...

How to remove the volume groups and the logical volumes?

Unknown said...
This comment has been removed by the author.
Unknown said...

Hi,
1) why the vgda count of 2pvs in a vg is 3 not 2 if quorum value is not satisfied how it is not satisfied
2) when vg is on and quorum value fall less than 51% vg will off automatically then after how to vary on vg
3) why stale partitions are created while mirroring an lv

Unknown said...

reducevg vgname

Unknown said...

how can we extract data from a pv?

Jerry said...

Hi.
I tried to execute this command on the cluster's service node : 'extendvg hdiskX VG_X'
(hdiskX has PVID and VG_X is a concurrent VG. hdiskX was recognized by Service node and Stanby node)
But this comannd failed.

I noticed that on the standby node hdiskX don't have PVID(in the result of 'lspv' command).
After executing 'chvg -l hdiskX -a pv=yes' , I tried 'extendvg hdiskX VG_X' on the service node again and it succeeded.

Why 'extendvg hdiskX VG_X' faild at first and succeeded in the end?

Raja said...

Hi,

Could you please explain lsattr -El hdiskxx output

Anonymous said...

Hi,
what could be the cause if a disk is missing from vg after reboot of server

Anonymous said...

and how to find the the missing disk. if varyon vg command will not find the missing disk

santhosh455 said...

after adding disks to the VG can we change disk attribute like queue depth value and Algorithm for the disks ?
will it reflect with out doing reboot/varyoff vg ?
do we require to reboot the server ?

aix said...

Hi, if you check the disk with lsattr, those parameters where you see "True+" can be changed online, without reboot etc.