I've a remote script that checks for some parameters from lvm volumes. One of the things I need to know is the size. I am currently using this:
lvdisplay /dev/virtuals/volume_name -C -o lv_size
But the last comand can take about one second to be executed on my server and I have multiple volumes I want to check. I've also tried usin lvs instead of lvdisplay, but there's no much improvement in the speed.
time lvs -o lv_size /dev/virtuals/volume_name -C -o lv_size real 0m0.809s time lvdisplay /dev/virtuals/volume_name real 0m0.982s
Does someone know a faster way to obtain that information, just the volume size, I am not interested on the ocupation.
Update: Using blockdev gives a massive improvement. I really recomment using it instead of lvdisplay (just remembere to use the getsize64)
time blockdev --getsize64 /dev/system/home