openmediavault  4.0 (Arrakis)
The open network attached storage solution
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
OMV\System\BlockDevice Class Reference
Inheritance diagram for OMV\System\BlockDevice:
OMV\System\IBlockDevice OMV\System\Filesystem\Filesystem OMV\System\Storage\StorageDevice OMV\System\Filesystem\Btrfs OMV\System\Filesystem\Ext OMV\System\Filesystem\Jfs OMV\System\Filesystem\Xfs OMV\System\Storage\SmartStorageDeviceAbstract OMV\System\Storage\StorageDeviceBcache OMV\System\Storage\StorageDeviceCDROM OMV\System\Storage\StorageDeviceDM OMV\System\Storage\StorageDeviceI2O OMV\System\Storage\StorageDeviceLoop OMV\System\Storage\StorageDeviceMdadm OMV\System\Storage\StorageDeviceMMC OMV\System\Storage\StorageDeviceNVM OMV\System\Storage\StorageDeviceRDB OMV\System\Storage\StorageDeviceXen

Public Member Functions

 __construct ($deviceFile)
 
 exists ()
 
 assertExists ()
 
 getDeviceFile ()
 
 getCanonicalDeviceFile ()
 
 getDeviceFileById ()
 
 hasDeviceFileById ()
 
 getDeviceFileByPath ()
 
 hasDeviceFileByPath ()
 
 getPredictableDeviceFile ()
 
 getPreferredDeviceFile ()
 
 getDeviceFileSymlinks ()
 
 getDeviceName ($canonical=FALSE)
 
 getSize ()
 
 getBlockSize ()
 
 getSectorSize ()
 
 getDeviceNumber ()
 
 getMajor ()
 
 getMinor ()
 
 getDescription ()
 
 hasUdevProperty ($id)
 
 assertUdevProperty ($id)
 
 getUdevProperty ($id)
 
 waitForDevice ($timeout)
 

Protected Member Functions

 getUdevData ($force=FALSE)
 

Protected Attributes

 $deviceFile = NULL
 
 $deviceFileById = NULL
 
 $size = FALSE
 
 $blockSize = FALSE
 
 $sectorSize = FALSE
 
 $udevData = NULL
 

Detailed Description

This class implements an interface to a generic Linux block device.

Constructor & Destructor Documentation

◆ __construct()

OMV\System\BlockDevice::__construct (   $deviceFile)

Constructor

Parameters
deviceFileThe device file, e.g.
/dev/sda2
  • /dev/sdb
  • /dev/md1
  • /dev/disk/by-id/scsi-SATA_ST3200XXXX2AS_5XWXXXR6
  • /dev/disk/by-id/wwn-0x5000cca211cc703c-part1
  • /dev/disk/by-id/md-name-vmpc01:data
  • /dev/disk/by-id/md-uuid-75de9de9:6beca92e:8442575c:73eabbc9
  • /dev/disk/by-id/lvm-pv-uuid-VDH5Om-Rkjc-cQid-PeJI-Sfqm-66DI-w0dpCO

Member Function Documentation

◆ assertExists()

OMV\System\BlockDevice::assertExists ( )

Assert that the device exists.

Returns
None.
Exceptions

◆ assertUdevProperty()

OMV\System\BlockDevice::assertUdevProperty (   $id)

Assert that a udev property exists.

Parameters
idThe name of the property, e.g. ID_VENDOR, ID_MODEL or ID_SERIAL_SHORT.
Returns
None.
Exceptions

◆ exists()

OMV\System\BlockDevice::exists ( )

See interface definition.

Implements OMV\System\IBlockDevice.

◆ getBlockSize()

OMV\System\BlockDevice::getBlockSize ( )

Get the blocksize of the device in bytes.

Returns
The blocksize of the device in bytes.
Exceptions

Implements OMV\System\IBlockDevice.

◆ getCanonicalDeviceFile()

OMV\System\BlockDevice::getCanonicalDeviceFile ( )

See interface definition.

Implements OMV\System\IBlockDevice.

◆ getDescription()

OMV\System\BlockDevice::getDescription ( )

See interface definition.

Implements OMV\System\IBlockDevice.

◆ getDeviceFile()

OMV\System\BlockDevice::getDeviceFile ( )

See interface definition.

Implements OMV\System\IBlockDevice.

◆ getDeviceFileById()

OMV\System\BlockDevice::getDeviceFileById ( )

See interface definition.

Implements OMV\System\IBlockDevice.

◆ getDeviceFileByPath()

OMV\System\BlockDevice::getDeviceFileByPath ( )

Get the device file by PATH, e.g.

/dev/disk/by-path/pci-0000:00:17.0-ata-3

  • /dev/disk/by-path/pci-0000:00:10.0-scsi-0:0:0:0
  • /dev/disk/by-path/pci-0000:00:10.0-scsi-0:0:1:0-part1
    Returns
    The device file (/dev/disk/by-path/xxx) if available, otherwise NULL will be returned.

Implements OMV\System\IBlockDevice.

◆ getDeviceFileSymlinks()

OMV\System\BlockDevice::getDeviceFileSymlinks ( )

See interface definition.

Implements OMV\System\IBlockDevice.

◆ getDeviceName()

OMV\System\BlockDevice::getDeviceName (   $canonical = FALSE)

See interface definition.

Implements OMV\System\IBlockDevice.

◆ getDeviceNumber()

OMV\System\BlockDevice::getDeviceNumber ( )

See interface definition.

Implements OMV\System\IBlockDevice.

◆ getMajor()

OMV\System\BlockDevice::getMajor ( )

See interface definition.

Implements OMV\System\IBlockDevice.

◆ getMinor()

OMV\System\BlockDevice::getMinor ( )

See interface definition.

Implements OMV\System\IBlockDevice.

◆ getPredictableDeviceFile()

OMV\System\BlockDevice::getPredictableDeviceFile ( )

Get a predictable device file in the following order:

/dev/disk/by-id/xxx

  • /dev/disk/by-path/xxx
  • /dev/xxx
    Returns
    Returns a device file.

Implements OMV\System\IBlockDevice.

◆ getPreferredDeviceFile()

OMV\System\BlockDevice::getPreferredDeviceFile ( )

Get the device file to present in the UI, e.g.:

/dev/disk/by-id/xxx

  • /dev/disk/by-path/xxx
  • /dev/xxx
    Returns
    Returns a device file.

Implements OMV\System\IBlockDevice.

◆ getSectorSize()

OMV\System\BlockDevice::getSectorSize ( )

Get the sectorsize of the device in bytes.

Returns
The sectorsize of the device in bytes.
Exceptions

Implements OMV\System\IBlockDevice.

◆ getSize()

OMV\System\BlockDevice::getSize ( )

Get the size of the device in bytes.

Returns
The size (64bit) of the device in bytes as string.
Exceptions

Implements OMV\System\IBlockDevice.

◆ getUdevData()

OMV\System\BlockDevice::getUdevData (   $force = FALSE)
protected

Queries the udev database for device information stored in the udev database.

Parameters
forceForce the collection of the information, even when the information is already cached. Defaults to FALSE.

◆ getUdevProperty()

OMV\System\BlockDevice::getUdevProperty (   $id)

Queries the udev database for device information stored in the udev database.

Parameters
idThe name of the property, e.g. ID_VENDOR, ID_MODEL or ID_SERIAL_SHORT.
Returns
The requested property, otherwise FALSE.

◆ hasDeviceFileById()

OMV\System\BlockDevice::hasDeviceFileById ( )

Check whether the device has a /dev/disk/by-id/xxx device path.

Returns
Returns TRUE if a disk/by-id device path exists, otherwise FALSE.

Implements OMV\System\IBlockDevice.

◆ hasDeviceFileByPath()

OMV\System\BlockDevice::hasDeviceFileByPath ( )

Check whether the device has a /dev/disk/by-path/xxx device path.

Returns
Returns TRUE if a disk/by-path device path exists, otherwise FALSE.

Implements OMV\System\IBlockDevice.

◆ hasUdevProperty()

OMV\System\BlockDevice::hasUdevProperty (   $id)

Checks if a udev property exists.

Parameters
idThe name of the property, e.g. ID_VENDOR, ID_MODEL or ID_SERIAL_SHORT.
Returns
Returns TRUE if the property exists, otherwise FALSE.

◆ waitForDevice()

OMV\System\BlockDevice::waitForDevice (   $timeout)

Wait for the specified device. If the device file is not available within the given time, then an exception is thrown.

Parameters
timeoutTimeout in seconds to wait for an available device.
Returns
None.
Exceptions

Implements OMV\System\IBlockDevice.


The documentation for this class was generated from the following file: