The task: to calculate the exact size of the useful space on the PV-volume based on the size of the partition on which the PV is located.

Context: There is a PV partition, for it you can make pvs --unit B -o pv_name,pv_size and find out the exact size of PV in bytes at the moment. In this case, PV does not occupy the entire volume of the underlying partition / disk. There is a size of the underlying partition / disk in bytes.

It is necessary to calculate the useful PV volume after it is expanded to the entire underlying disk with the pvresize command, but without the actual extension (i.e., expanding and viewing does not fit - it is necessary to calculate in advance).

  • pvresize call with options -t ( --test ) and -v ( --verbose ) not suitable? - aleksandr barakin
  • The -t option has already been found, but the task remains for a slightly different context: a new partition will be created and PV on it. We need to know the useful size of the new PV without creating a partition and without creating a PV, i.e. purely calculated method. - rekby
  • make changes to the question, or (better) delete the current one (you and the moderators only have the right to delete) and set a new one. - aleksandr barakin
  • Issue the answer with the answer - I will mark it, because He solves the problem and create a new question. - rekby

1 answer 1

according to man pvresize , this program has the option -t ( --test ).

when launched with this option (and with the -v ( --verbose ) option), no real changes will be made, but the output will contain all the (usual) information about changing the size of the physical volume.