disk

package
v0.0.0-...-b8194df Latest Latest
Warning

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

Go to latest
Published: May 20, 2023 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDiskutilPath

func GetDiskutilPath() (string, error)

GetDiskutilPath executes `which diskutil` and returns path

func GetMountedVolumes

func GetMountedVolumes() ([]string, error)

func GetOsVersion

func GetOsVersion() (*version.Version, error)

GetOsVersion executes `sw_vers -productVersion` command and returns semver compliant version on success

func MountDisk

func MountDisk(disk DiskInfo, withSudo bool) (string, error)

func UnmountDisk

func UnmountDisk(disk DiskInfo) (string, error)

Types

type DiskInfo

type DiskInfo struct {
	Content                   string `plist:"Content"`
	DeviceIdentifier          string `plist:"DeviceIdentifier"`
	DeviceNode                string `plist:"DeviceNode"`
	DiskUUID                  string `plist:"DiskUUID"`
	VolumeName                string `plist:"VolumeName"`
	VolumeUUID                string `plist:"VolumeUUID"`
	ParentWholeDisk           string `plist:"ParentWholeDisk"`
	WholeDisk                 bool   `plist:"WholeDisk"`
	MountPoint                string `plist:"MountPoint"`
	FilesystemName            string `plist:"FilesystemName"`
	FilesystemUserVisibleName string `plist:"FilesystemUserVisibleName"`
	FilesystemType            string `plist:"FilesystemType"`
	APFSContainerReference    string `plist:"APFSContainerReference"`
	APFSPhysicalStores        []struct {
		APFSPhysicalStore string `plist:"APFSPhysicalStore"`
	} `plist:"APFSPhysicalStores"`
}

func GetDiskInfo

func GetDiskInfo(disk string) (diskInfo DiskInfo, err error)

GetDiskInfo executes `diskutil info -plist <disk>` command and returns DiskInfo

func GetVolumeInfo

func GetVolumeInfo(volume string) (diskInfo DiskInfo, err error)

func (*DiskInfo) GetApfsPhysicalStores

func (d *DiskInfo) GetApfsPhysicalStores() []string

func (*DiskInfo) IsApfs

func (d *DiskInfo) IsApfs() bool

func (*DiskInfo) IsApfsContainer

func (d *DiskInfo) IsApfsContainer() bool

func (*DiskInfo) IsCoreStorageContainer

func (d *DiskInfo) IsCoreStorageContainer() bool

func (*DiskInfo) IsEfi

func (d *DiskInfo) IsEfi() bool

func (*DiskInfo) IsMounted

func (d *DiskInfo) IsMounted() bool

type DiskList

type DiskList struct {
	AllDisks         []string `plist:"AllDisks"`
	VolumesFromDisks []string `plist:"VolumesFromDisks"`
	WholeDisks       []string `plist:"WholeDisks"`
}

func GetDiskList

func GetDiskList() (list DiskList, err error)

GetDiskList executes `diskutil list -plist` and returns DiskList

type Disks

type Disks struct {
	// contains filtered or unexported fields
}

func NewDisks

func NewDisks(target []string) *Disks

func (*Disks) FindEfiFor

func (d *Disks) FindEfiFor(parent DiskInfo) (DiskInfo, error)

FindEfiFor will try to find the EFI volume, owned by the provided disk.

func (*Disks) FindParentFor

func (d *Disks) FindParentFor(disk DiskInfo) (DiskInfo, error)

FindParentFor will try to the root physical storage.

func (*Disks) GetIdentifiers

func (d *Disks) GetIdentifiers() []string

func (*Disks) Update

func (d *Disks) Update()

Jump to

Keyboard shortcuts

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