Crate block_utils

Source

Modules§

nvme

Structs§

AsyncInit
Device
Device information that is gathered with udev
Enclosure
A raid array enclosure
ScsiInfo

Enums§

BlockUtilsError
DeviceState
DeviceType
What type of device has been detected.
Filesystem
This allows you to tweak some settings when you’re formatting the filesystem
FilesystemType
What type of filesystem
MediaType
What type of media has been detected.
MetadataProfile
This is used for formatting btrfs filesystems and setting the metadata profile
Scheduler
ScsiDeviceType
Vendor
What raid card if any the system is using to serve disks

Functions§

async_format_block_device
erase_block_device
format_block_device
Synchronous utility to format a block device with a given filesystem. Note: ZFS creation can be slow because there’s potentially several commands that need to be run. async_format_block_device will be faster if you have many block devices to format
get_all_device_info
Returns device info on every device it can find in the devices slice The device info may not be in the same order as the slice so be aware. This function is more efficient because it only call udev list once
get_all_device_info_iter
Returns iterator over device info on every device it can find in the devices slice The device info may not be in the same order as the slice so be aware. This function is more efficient because it only call udev list once
get_block_dev_properties
Get properties for device with devpath device_path (like “/dev/sda”) if present
get_block_dev_property
Get property value by key tag for device with devpath device_path (like “/dev/sda”) if present
get_block_devices
Scan a system and return all block devices that udev knows about This function will skip udev devices identified as partition. If it can’t discover this it will error on the side of caution and return the device
get_block_devices_iter
Scan a system and return iterator over all block devices that udev knows about This function will skip udev devices identified as partition. If it can’t discover this it will error on the side of caution and return the device
get_block_partitions
Scan a system and return all block devices that udev knows about This function will only retun the udev devices identified as partition. If it can’t discover this it will error on the side of caution and return the device
get_block_partitions_iter
Scan a system and return iterator over all block devices that udev knows about This function will only retun the udev devices identified as partition. If it can’t discover this it will error on the side of caution and return the device
get_children_devpaths_from_path
Get the children devices paths from a device path
get_children_devpaths_from_path_iter
Get the children devices paths from a device path Note: It has square algorithmic complexity
get_device_from_path
returns the device info and possibly partition entry for the device with the path or symlink given
get_device_info
Returns device information that is gathered with udev.
get_mount_device
Parse mtab and return the device which is mounted at a given directory
get_mounted_devices
Parse mtab and return all mounted block devices not including LVM
get_mounted_devices_iter
Parse mtab and return iterator over all mounted block devices not including LVM
get_mountpoint
Parse mtab and return the mountpoint the device is mounted at. This is the opposite of get_mount_device
get_parent_devpath_from_path
get the parent device path from a device path (If not a partition or disk, return None)
get_scsi_info
Gathers all available scsi information
is_block_device
Checks to see if the subsystem this device is using is block
is_disk
check if the path is a disk device path
is_mounted
Checks and returns if a particular directory is a mountpoint
mount_device
Utility function to mount a device at a mount point NOTE: This assumes the device is formatted at this point. The mount will fail if the device isn’t formatted.
set_elevator
sort_scsi_info
Examine the ScsiInfo devices and associate a host ScsiInfo device if it exists
sort_scsi_info_iter
Examine the ScsiInfo devices and associate a host ScsiInfo device if it exists
unmount_device
weekly_defrag

Type Aliases§

BlockResult