+ (* Run blockdev --getsize64 on each partition to get its size.
+ *
+ * Returns a list of partitions and their size in bytes.
+ *)
+ let all_partitions : (partition * int64) list =
+ List.filter_map (
+ fun part ->
+ let cmd = "blockdev --getsize64 " ^ quote (dev_of_partition part) in
+ let lines = shget cmd in
+ match lines with
+ | Some (blksize::_) -> Some (part, Int64.of_string blksize)
+ | Some [] | None -> None
+ ) all_partitions in
+