Documentation
¶
Index ¶
- Constants
- func AddNewPV(devicePath string, vg string) error
- func CommandFindMnt() *command[FindMntResult]
- func CommandLBLK() *command[BlkResult]
- func CommandLVS() *command[LvsResult]
- func CommandPVS() *command[PvsResult]
- func CommandVGS() *command[VgsResult]
- func DeactivateLv(vg string) error
- func DeleteDevicePartitions(devicePath string) error
- func ExtendLv(vg, lv string) error
- func FindMountpointsByLvDmPath(lvDmPath string) ([]string, error)
- func FindUnmountedDevices() (map[string]*BlkPart, error)
- func MakePartOnDevice(devicePath string) error
- func RemoveLv(lvpath string) error
- func RemovePv(pv string) error
- func RemoveVg(vg string) error
- type BlkList
- type BlkPart
- type BlkResult
- type Filesystem
- type FindMntResult
- type LvItem
- type LvsResult
- type PvItem
- type PvsResult
- type VgItem
- type VgsResult
Constants ¶
View Source
const ( LVS = "lvs" VGS = "vgs" PVS = "pvs" )
View Source
const FINDMNT = "findmnt"
View Source
const LBLK = "lsblk"
lsblk -J
{
"blockdevices": [
{
"name": "nvme0n1",
"maj:min": "259:0",
"rm": false,
"size": "1.9T",
"ro": false,
"type": "disk",
"mountpoints": [
null
],
"children": [
{
"name": "nvme0n1p1",
"maj:min": "259:1",
"rm": false,
"size": "512M",
"ro": false,
"type": "part",
"mountpoints": [
"/boot/efi"
]
},{
"name": "nvme0n1p2",
"maj:min": "259:2",
"rm": false,
"size": "1.9T",
"ro": false,
"type": "part",
"mountpoints": [
null
],
"children": [
{
"name": "olares--vg-swap",
"maj:min": "252:0",
"rm": false,
"size": "1G",
"ro": false,
"type": "lvm",
"mountpoints": [
"[SWAP]"
]
},{
"name": "olares--vg-root",
"maj:min": "252:1",
"rm": false,
"size": "100G",
"ro": false,
"type": "lvm",
"mountpoints": [
"/"
]
},{
"name": "olares--vg-data",
"maj:min": "252:2",
"rm": false,
"size": "1.8T",
"ro": false,
"type": "lvm",
"mountpoints": [
"/olares", "/var"
]
}
]
}
]
}
]
}
Variables ¶
This section is empty.
Functions ¶
func CommandFindMnt ¶
func CommandFindMnt() *command[FindMntResult]
func CommandLBLK ¶
func CommandLBLK() *command[BlkResult]
func CommandLVS ¶
func CommandLVS() *command[LvsResult]
func CommandPVS ¶
func CommandPVS() *command[PvsResult]
func CommandVGS ¶
func CommandVGS() *command[VgsResult]
func DeactivateLv ¶
func DeleteDevicePartitions ¶
wipefs -a /dev/nvme0n1 sgdisk --zap-all /dev/nvme0n1
func ExtendLv ¶
lvextend -l +100%FREE "/dev/$VG_NAME/$LV_ROOT_NAME" resize2fs "/dev/$VG_NAME/$LV_ROOT_NAME"
func FindUnmountedDevices ¶
func MakePartOnDevice ¶
sudo parted /dev/sdX mklabel gpt sudo parted -a optimal /dev/sdX mkpart primary 1MiB 100%
Types ¶
type Filesystem ¶
type Filesystem struct {
Target string `json:"target"`
Source string `json:"source"`
Fstype string `json:"fstype"`
Options string `json:"options"`
}
findmnt -n -J --target /olares
{
"filesystems": [
{
"target": "/olares",
"source": "/dev/mapper/olares--vg-data[/olares]",
"fstype": "ext4",
"options": "rw,relatime"
}
]
}
type FindMntResult ¶
type FindMntResult struct {
Filesystems []Filesystem `json:"filesystems"`
}
type LvItem ¶
type LvItem struct {
LvName string `json:"lv_name"`
VgName string `json:"vg_name"`
LvAttr string `json:"lv_attr"`
LvSize string `json:"lv_size"`
PoolLv string `json:"pool_lv"`
Origin string `json:"origin"`
DataPercent string `json:"data_percent"`
MetadataPercent string `json:"metadata_percent"`
MovePv string `json:"move_pv"`
MirrorLog string `json:"mirror_log"`
CopyPercent string `json:"copy_percent"`
ConvertLv string `json:"convert_lv"`
LvPath string `json:"lv_path"`
LvDmPath string `json:"lv_dm_path"`
Mountpoints []string `json:"mountpoints"`
}
{
"report": [
{
"lv": [
{"lv_name":"data", "vg_name":"olares-vg", "lv_attr":"-wi-ao----", "lv_size":"1.76t", "pool_lv":"", "origin":"", "data_percent":"", "metadata_percent":"", "move_pv":"", "mirror_log":"", "copy_percent":"", "convert_lv":""},
{"lv_name":"root", "vg_name":"olares-vg", "lv_attr":"-wi-ao----", "lv_size":"100.00g", "pool_lv":"", "origin":"", "data_percent":"", "metadata_percent":"", "move_pv":"", "mirror_log":"", "copy_percent":"", "convert_lv":""},
{"lv_name":"swap", "vg_name":"olares-vg", "lv_attr":"-wi-ao----", "lv_size":"1.00g", "pool_lv":"", "origin":"", "data_percent":"", "metadata_percent":"", "move_pv":"", "mirror_log":"", "copy_percent":"", "convert_lv":""}
]
}
]
}
func FindLvByVgName ¶
type LvsResult ¶
type LvsResult struct {
Report []struct {
Lv []LvItem `json:"lv"`
} `json:"report"`
}
type PvItem ¶
type PvItem struct {
PvName string `json:"pv_name"`
VgName string `json:"vg_name"`
PvFmt string `json:"pv_fmt"`
PvAttr string `json:"pv_attr"`
PvSize string `json:"pv_size"`
PvFree string `json:"pv_free"`
}
{
"report": [
{
"pv": [
{"pv_name":"/dev/nvme0n1p2", "vg_name":"olares-vg", "pv_fmt":"lvm2", "pv_attr":"a--", "pv_size":"1.86t", "pv_free":"0 "}
]
}
]
}
type PvsResult ¶
type PvsResult struct {
Report []struct {
Pv []PvItem `json:"pv"`
} `json:"report"`
}
type VgItem ¶
type VgItem struct {
VgName string `json:"vg_name"`
PvCount string `json:"pv_count"`
LvCount string `json:"lv_count"`
SnapCount string `json:"snap_count"`
VgAttr string `json:"vg_attr"`
VgSize string `json:"vg_size"`
VgFree string `json:"vg_free"`
PvName string `json:"pv_name"`
}
{
"report": [
{
"vg": [
{"vg_name":"olares-vg", "pv_count":"1", "lv_count":"3", "snap_count":"0", "vg_attr":"wz--n-", "vg_size":"1.86t", "vg_free":"0 "}
]
}
]
}
func FindCurrentLVM ¶
func FindVgsOnDevice ¶
Click to show internal directories.
Click to hide internal directories.