mirage-block-partition

Mirage block device partitioning
README

Mirage-block-partition lets you view a mirage block device as smaller partitions.
The interface is structured around (successively) partitioning into two smaller partitions.
The reason for this at times perhaps slightly inconvenient interface is it makes it harder to accidentally construct overlapping partitions.

module Make(B : Mirage_block.S)(Clock : Mirage_clock.PCLOCK) = struct

  module Partitioned = Mirage_block_partition.Make(B)
  module Tar = Tar_mirage.Make_KV_RO(Partitioned)
  module Chamelon = Kv.Make(Partitioned)(Clock)

  let start b =
    let open Lwt.Syntax in
    (* b1 is the first twenty sectors, b2 is the next 8k sectors (4 MiB),
       and b3 is the remaining space. Note that the initial [connect] call is
       asynchronous while the later [subpartition] calls are not. If the
       partition point is outside the block device or subpartition then an
       exception is raised. *)
    let* b1, rest = Partitioned.connect 20L b in
    let b2, b3 = Partitioned.subpartition 8192L rest in
    (* now use e.g. b1 as a tar KV store, b2 as a chamelon filesystem,
       b3 as a raw block device... *)
    let* tar = Tar.connect b1
    and* chamelon = Chamelon.connect ~program_size:16 b2 in
    ...

end

mirage-block-partition-mbr

This module reads a disk labeled with a Master Boot Record and returns a list of pairs of Mbr.Partition.t and a block device representing the partition according to the MBR.

Install
Published
28 Sep 2022
Sources
mirage-block-partition-0.1.0.tbz
sha256=cef80c615dcdefad27055e9d309077896d73e8be0ca001c69698cf372ed60c0a
sha512=d8c75976c97028bb738a25d61078234b9b36c20a225b8cbf30d3c9afeaba94f1734fd98ab3af7508d334d6884f9bfde0d36d8d544d99c5eb5f8b156bd4f60505
Dependencies
alcotest-lwt
with-test
alcotest
with-test
mbr-format
>= "1.0.0"
lwt
>= "5.6.0"
mirage-block
>= "3.0.0"
ocaml
>= "4.08.0"
dune
>= "3.4"
Reverse Dependencies