LVM commands tutorial : Part 1 : Physical Volume (pvchange, pvmove)

This is second post on LVM tutorial. Rest posts from this series can be found on below links.

This is last post for part 1 which is dedicated to physical volume. In last post we saw pvcreate and pvdisplay. This post we will be checking out pvchange and pvmove commands.

Command : pvchange

pvchange used for changing attributes of physical volume. There are 6 options switch which can be used with this command. Lets see them one by one.

-a

This switch used for availability attribute of PV. This should be accompany with y or n argument. y making PV available and n making it unavailable. You can see example below with n argument which turn PV unavailable which can be verified in pvdisplay output.

-S

This switch enables or disables autoswitching. It also has y or n argument. If activated it makes current access path to switch on better available path. If de activated, path switching happens only if current access path goes to un-available state (due to hardware, cable failure). This applies to disks with multi paths only.

-t

Its a timeout value. This switch should be supplied with number of seconds. This value determines if IO timeout happens and problem can be declared for IO on particular PV. Useful in clustering.

-x

It enables or disables extensibility of PV. This switch has y and n arguments which enables admin to add/restrict physical extents to PV. Refer LVM legends to have better understanding.

-s

Immediately begin accessing the associated physical volume.

-z

Defines PV is spare or regular. This option has significance in mirroing only.


Command : pvmove

As name suggests, it used to move data (in LVM term PE) from one PV to another PV. Command essential moves PEs and hence data within from source to destination PV. If destination PV is not specified then all available PV’s in current volume group are considered for move operation. Command decides himself best suited PV for move operation so that allocation policies can be met correctly.

Also if command is supplied with list of PV names then first PV is always considered as source and rest all PVs are considered as destination.

In above example PEs will be moved from disk 1 to disk2 & disk3.

You can also move data for particular lvol to new PV.

In above example PE belonging to lvol2 will be moved from disk1 to disk2. PE distribution can be confirmed via lvdisplay output.

This marks end of part 1 : Physical volume. If you have any questions, please drop in comments below.

 

Any thoughts?