lvm2

package
v0.7.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package lvm2 reads LVM2 physical volumes (and the volume groups on them) directly from a block device or disk image, without the LVM tooling. It parses the PV label and the text-format volume-group metadata to expose each logical volume as a byte range so a filesystem reader can extract it.

Only the common single-PV case is supported: linear or single-stripe logical volumes whose physical extents all live on the one PV being read. Striped, mirrored and RAID logical volumes spanning multiple PVs are reported but not mapped to a contiguous range.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotLVM = errors.New("not an LVM2 physical volume")

ErrNotLVM is returned when the region does not hold an LVM2 physical volume.

Functions

This section is empty.

Types

type Extent

type Extent struct {
	Start int64 // byte offset relative to the PV start
	Size  int64 // bytes
}

Extent is one physical byte range of a logical volume, relative to the start of the physical volume (the partition holding the PV).

type LogicalVolume

type LogicalVolume struct {
	Name    string
	Size    int64
	Extents []Extent
}

LogicalVolume is a single logical volume mapped onto the physical volume that was read. Extents are ordered by offset and non-overlapping. An empty Extents slice means the volume could not be mapped (mirror/RAID/multi-PV).

type VG

type VG struct {
	Name        string
	Seqno       int64
	ExtentBytes int64 // bytes per physical extent
	PEStart     int64 // byte offset of the first physical extent, relative to the PV start
	PECount     int64 // number of physical extents
	Volumes     []LogicalVolume
}

VG is a parsed LVM2 volume group.

func Open

func Open(ra io.ReaderAt, origin int64) (*VG, error)

Open probes ra at origin (the byte offset of the partition holding the PV) for an LVM2 physical volume and returns the parsed volume group. The newest metadata snapshot (highest sequence number) wins.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL