Comment 4 for bug 1799953

Revision history for this message
Scott Moser (smoser) wrote :

It seems like to determine if the partition we grew is a lvm pv, we should probably just use 'pvs' with explicit input rather than grep. and probably should use 'lvm' command rather than 'pvs'.

has_cmd() { command -v "$1" >/dev/null ; }

# 'lvm pvs <device>' seems to exit 0 when <device> is a pv and 5 otherwise.
if has_cmd lvm && lvm pvs --readonly -o pv_name "$part_path" >/dev/null 2>&1; then
    debug "$part_path was a lvm pv, going to use pvresize"
    lvm pvresize "$part_path" || echo "bad news, lvm pvresize $part_path failed"
fi