FileSystem class
- class diskinfo.FileSystem(_device)[source]
This class encapsulates filesystem-related information read from a block device’s udev properties. It is used by both
PartitionandDiskto represent filesystem data.Note
The mounting point and available space are determined by reading
/proc/mountsand callingos.statvfs(). If the file system is not mounted, the mounting point will be empty and the free size will be0.
- Parameters:
_device (pyudev.Device) – pyudev.Device class
- get_fs_free_size()[source]
Returns the free size of the file system in 512-byte blocks. The result could be 0 if the device does not contain a file system or if the file system is not mounted.
- Return type:
- get_fs_free_size_in_hrf(units=0)[source]
Returns the free size of the file system in human-readable form. The result could be 0 if the device does not contain a file system or if the file system is not mounted.
- Parameters:
units (int) –
unit system will be used for the calculation and in the result:
0 metric units (default)
1 IEC units
2 legacy units
Read more about units here.
- Returns:
size in human-readable form, proper unit
- Return type:
- get_fs_label()[source]
Returns the label of the file system. The result could be empty if the file system does not have a label.
- Return type:
- get_fs_mounting_point()[source]
Returns the mounting point of the file system. The result could be empty if the device does not contain any file system, or it is not mounted.
- Return type:
- get_fs_size()[source]
Returns the total size of the file system in 512-byte blocks. The result could be 0 if the device does not contain a file system or if the file system is not mounted.
- Return type:
- get_fs_size_in_hrf(units=0)[source]
Returns the total size of the file system in human-readable form. The result could be 0 if the device does not contain a file system or if the file system is not mounted.
- Parameters:
units (int) –
unit system will be used for the calculation and in the result:
0 metric units (default)
1 IEC units
2 legacy units
Read more about units here.
- Returns:
size in human-readable form, proper unit
- Return type:
- get_fs_type()[source]
Returns the type of the file system. The result could be empty if the device does not contain a file system.
- Return type:
- get_fs_usage()[source]
Returns the usage of the file system. The result could be empty if the device does not contain a file system. Valid values are
filesystemorotherfor special devices (e.g. for a swap partition).- Return type: