detkit.Disk.partition_info#

static Disk.partition_info(path)#

Disk partition info.

Parameters:
pathstr

Path of a directory or file within the disk partition.

Returns:
part_info

An object containing disk’s partition information. If no partition is found, None is returned. The object contains the following attributes:

  • 'device': disk device corresponding to the partition

  • 'mountpoint': Mount point of the partition

  • 'fstype': file system type of the partition

  • 'opts': options where the partition is configured with

  • 'maxfile': maxfile of partition

  • 'maxpath': maxpath of partition

Notes

This is a static method and does not need the detkit.Disk to be instantiated (see example below).

Examples

>>> from detkit import Disk
>>> part_info = Disk.partition_info('/home')

>>> # Get device
>>> print(part_info.device)
'/dev/nvme0n1p7'

>>> # Get mount point
>>> print(part_info.mountpoint)
'/'

>>> # Get file system type
>>> print(part_info.fstype)
'ext4'