diff --git a/pvshrink b/pvshrink index b2481aa..9990c52 100755 --- a/pvshrink +++ b/pvshrink @@ -48,7 +48,7 @@ while True: used_blocks = [] try: - pvs = subprocess.check_output(['pvs','--segments','-o','lv_name,pv_segstart,pv_segsize','--separator',',','--noheadings',device]) + pvs = subprocess.check_output(['pvs','--segments','-o','lv_name,pv_segstart,pv_segsize','--separator',',','--noheadings',device]).decode('utf-8') except subprocess.CalledProcessError as exc: die("Error calling pvs (%d)" % exc.returncode) @@ -113,7 +113,7 @@ while True: total_segments_moved = total_segments_moved + size print("%d of %d (%.2f%%) done" % (total_segments_moved, total_segments_to_move, 100*float(total_segments_moved)/float(total_segments_to_move))) -pvck = subprocess.check_output(['pvck', device]) +pvck = subprocess.check_output(['pvck', device]).decode('utf-8') match = re.search(r'Found text metadata area: offset=(\d+), size=(\d+)', pvck) if match is None: @@ -123,7 +123,7 @@ if match is None: metadata_size = int(match.group(1)) + int(match.group(2)) print("Metadata size: %d b" % metadata_size) -pvdisplay = subprocess.check_output(['pvdisplay','--units','b', device]) +pvdisplay = subprocess.check_output(['pvdisplay','--units','b', device]).decode('utf-8') match = re.search(r'PE Size\s*(\d+)', pvdisplay) if match is None: