openmediavault  4.0 (Arrakis)
The open network attached storage solution
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
OMV\System\Filesystem\Filesystem Class Reference
Inheritance diagram for OMV\System\Filesystem\Filesystem:
OMV\System\BlockDevice OMV\System\Filesystem\IFilesystem OMV\System\Filesystem\ISharedFolderCandidate OMV\System\IBlockDevice OMV\System\Filesystem\Btrfs OMV\System\Filesystem\Ext OMV\System\Filesystem\Jfs OMV\System\Filesystem\Xfs

Public Member Functions

 __construct ($id)
 
 refresh ()
 
 exists ()
 
 hasUuid ()
 
 assertUuid ()
 
 getUuid ()
 
 hasLabel ()
 
 assertLabel ()
 
 getLabel ()
 
 getType ()
 
 getPartitionType ()
 
 getPartitionScheme ()
 
 getUsage ()
 
 getPartitionEntry ()
 
 getDeviceFile ()
 
 getDeviceFileByUuid ()
 
 hasDeviceFileByUuid ()
 
 getDeviceFileById ()
 
 hasDeviceFileById ()
 
 getDeviceFileByLabel ()
 
 hasDeviceFileByLabel ()
 
 getParentDeviceFile ()
 
 getPredictableDeviceFile ()
 
 getDeviceFiles ()
 
 hasMultipleDevices ()
 
 getBlockSize ()
 
 grow ()
 
 shrink ()
 
 remove ()
 
 getMountPoint ()
 
 getStatistics ()
 
 isMounted ()
 
 mount ($options="", $dir="")
 
 umount ($force=FALSE, $lazy=FALSE)
 
 setBackend (Backend\BackendAbstract $backend)
 
 getBackend ()
 
 getDescription ()
 
- Public Member Functions inherited from OMV\System\BlockDevice
 __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)
 
- Public Member Functions inherited from OMV\System\Filesystem\IFilesystem
 getCanonicalDeviceFile ()
 
 getPreferredDeviceFile ()
 
 getDeviceFileSymlinks ()
 
 getSize ()
 
 mount ($options)
 

Static Public Member Functions

static hasFileSystem ($deviceFile)
 
static getFilesystems ()
 
static getImpl ($id)
 
static assertGetImpl ($id)
 
static getImplByMountPoint ($dir)
 

Protected Member Functions

 isCached ()
 
 setCached ($cached)
 
 getData ()
 
- Protected Member Functions inherited from OMV\System\BlockDevice
 getUdevData ($force=FALSE)
 

Protected Attributes

 $uuid = ""
 
 $type = ""
 
 $label = ""
 
 $partEntry = NULL
 
 $usage = ""
 
- Protected Attributes inherited from OMV\System\BlockDevice
 $deviceFile = NULL
 
 $deviceFileById = NULL
 
 $size = FALSE
 
 $blockSize = FALSE
 
 $sectorSize = FALSE
 
 $udevData = NULL
 

Detailed Description

Class to get detailed information about a filesystem.

Constructor & Destructor Documentation

◆ __construct()

OMV\System\Filesystem\Filesystem::__construct (   $id)

Constructor

Parameters
idThe UUID or device path of the filesystem, e.g.
78b669c1-9183-4ca3-a32c-80a4e2c61e2d (EXT2/3/4, JFS, XFS)
  • 7A48-BA97 (FAT)
  • 2ED43920D438EC29 (NTFS)
  • /dev/sde1
  • /dev/disk/by-id/scsi-SATA_ST3200XXXX2AS_5XWXXXR6-part1
  • /dev/disk/by-label/DATA
  • /dev/disk/by-path/pci-0000:00:10.0-scsi-0:0:0:0-part2
  • /dev/disk/by-uuid/ad3ee177-777c-4ad3-8353-9562f85c0895
  • /dev/cciss/c0d0p2
  • /dev/disk/by-id/md-name-vmpc01:data
  • /dev/disk/by-id/md-uuid-75de9de9:6beca92e:8442575c:73eabbc9

Member Function Documentation

◆ assertGetImpl()

static OMV\System\Filesystem\Filesystem::assertGetImpl (   $id)
static
Exceptions

◆ assertLabel()

OMV\System\Filesystem\Filesystem::assertLabel ( )

Assert that the filesystem has a label.

Returns
None.
Exceptions

◆ assertUuid()

OMV\System\Filesystem\Filesystem::assertUuid ( )

Assert that the filesystem has an UUID.

Returns
None.
Exceptions

◆ exists()

OMV\System\Filesystem\Filesystem::exists ( )

Checks if the filesystem exists.

Returns
TRUE if the device exists, otherwise FALSE.

Implements OMV\System\Filesystem\IFilesystem.

◆ getBackend()

OMV\System\Filesystem\Filesystem::getBackend ( )
final

Get the backend of this filesystem.

◆ getBlockSize()

OMV\System\Filesystem\Filesystem::getBlockSize ( )

Get the filesystem block size.

Returns
The block size.
Exceptions

Implements OMV\System\IBlockDevice.

◆ getData()

OMV\System\Filesystem\Filesystem::getData ( )
protected

Get the filesystem detailed information.

Returns
None.
Exceptions

◆ getDescription()

OMV\System\Filesystem\Filesystem::getDescription ( )

Get the description of the file system.

Returns
The file system description.

Implements OMV\System\Filesystem\IFilesystem.

◆ getDeviceFile()

OMV\System\Filesystem\Filesystem::getDeviceFile ( )

Get the device path of the filesystem, e.g /dev/sdb1.

Returns
The device name.

Implements OMV\System\Filesystem\IFilesystem.

◆ getDeviceFileById()

OMV\System\Filesystem\Filesystem::getDeviceFileById ( )

Get the device path by ID, e.g.

/dev/disk/by-id/usb-Kingston_DataTraveler_G2_001CC0EC21ADF011C6A20E35-0:0-part1

Returns
The device path (/dev/disk/by-id/xxx).

Implements OMV\System\Filesystem\IFilesystem.

◆ getDeviceFileByLabel()

OMV\System\Filesystem\Filesystem::getDeviceFileByLabel ( )

Get the device path by label, e.g.

/dev/disk/by-label/data

Returns
The device path (/dev/disk/by-label/xxx).

Implements OMV\System\Filesystem\IFilesystem.

◆ getDeviceFileByUuid()

OMV\System\Filesystem\Filesystem::getDeviceFileByUuid ( )

Get the device path by UUID, e.g.

/dev/disk/by-uuid/ad3ee177-777c-4ad3-8353-9562f85c0895

  • /dev/disk/by-uuid/2ED43920D438EC29 (NTFS)
    Returns
    The device path (/dev/disk/by-uuid/xxx).

Implements OMV\System\Filesystem\IFilesystem.

◆ getDeviceFiles()

OMV\System\Filesystem\Filesystem::getDeviceFiles ( )

Get all devices that make up the filesystem.

Returns
An array that contains the component devices of the filesystem.

Implements OMV\System\Filesystem\IFilesystem.

◆ getFilesystems()

static OMV\System\Filesystem\Filesystem::getFilesystems ( )
static

Get all available/detected filesystems.

Returns
An array of Filesystem objects.
Exceptions

◆ getImpl()

static OMV\System\Filesystem\Filesystem::getImpl (   $id)
static

Get the object of the class which implements the specified filesystem for the given filesystem UUID or device path.

Parameters
idThe UUID or device path of the filesystem, e.g.
78b669c1-9183-4ca3-a32c-80a4e2c61e2d (EXT2/3/4, JFS, XFS)
  • 7A48-BA97 (FAT)
  • 2ED43920D438EC29 (NTFS)
  • /dev/sde1
  • /dev/disk/by-id/scsi-SATA_ST3200XXXX2AS_5XWXXXR6-part1
  • /dev/disk/by-label/DATA
  • /dev/disk/by-path/pci-0000:00:10.0-scsi-0:0:0:0-part2
  • /dev/disk/by-uuid/ad3ee177-777c-4ad3-8353-9562f85c0895
  • /dev/cciss/c0d0p2
Returns
The object of the class implementing the given filesystem, otherwise NULL.

◆ getImplByMountPoint()

static OMV\System\Filesystem\Filesystem::getImplByMountPoint (   $dir)
static

Get the object of the class which implements the specified filesystem for the given mount point.

Parameters
dirThe file system path prefix, e.g. '/home/ftp/data'.
Returns
The class object or NULL on failure.

◆ getLabel()

OMV\System\Filesystem\Filesystem::getLabel ( )

Get the filesystem label.

Returns
Returns the label of the filesystem, otherwise an empty string.

Implements OMV\System\Filesystem\IFilesystem.

◆ getMountPoint()

OMV\System\Filesystem\Filesystem::getMountPoint ( )

Get the mount point of the given filesystem.

Returns
The mountpoint of the filesystem or FALSE.
Exceptions

◆ getParentDeviceFile()

OMV\System\Filesystem\Filesystem::getParentDeviceFile ( )

Get the device file of the storage device which contains this file system. Example:

/dev/sdb1 => /dev/sdb

  • /dev/cciss/c0d0p2 => /dev/cciss/c0d0
    Returns
    The device file of the underlying storage device or NULL on failure.

Implements OMV\System\Filesystem\IFilesystem.

◆ getPartitionEntry()

OMV\System\Filesystem\Filesystem::getPartitionEntry ( )

Get the partition entry information.

Returns
An array with the fields scheme, uuid, type, flags, number, offset, size and disk, otherwise NULL.

◆ getPartitionScheme()

OMV\System\Filesystem\Filesystem::getPartitionScheme ( )

Get the partition scheme, e.g. 'gpt', 'mbr', 'apm' or 'dos'.

Returns
The filesystem type, otherwise NULL.

◆ getPartitionType()

OMV\System\Filesystem\Filesystem::getPartitionType ( )

Get the partition scheme, e.g. 'gpt', 'mbr', 'apm' or 'dos'.

Deprecated:
Returns
The filesystem type, otherwise NULL.

◆ getPredictableDeviceFile()

OMV\System\Filesystem\Filesystem::getPredictableDeviceFile ( )

Get the device file in the following order:

/dev/disk/by-label/xxx

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

Implements OMV\System\Filesystem\IFilesystem.

◆ getStatistics()

OMV\System\Filesystem\Filesystem::getStatistics ( )

Get statistics from a mounted filesystem.

Returns
The filesystem statistics if successful, otherwise FALSE. The following fields are included: devicefile, type, blocks, size, used, available, percentage and mountpoint. Please note, the fields size, used and available are strings and their unit is 'B' (bytes).
Exceptions

◆ getType()

OMV\System\Filesystem\Filesystem::getType ( )

Get the filesystem type, e.g. 'ext3' or 'vfat'.

Returns
The filesystem type.

Implements OMV\System\Filesystem\IFilesystem.

◆ getUsage()

OMV\System\Filesystem\Filesystem::getUsage ( )

Get the usage, e.g. 'other' or 'filesystem'.

Returns
The filesystem usage.

◆ getUuid()

OMV\System\Filesystem\Filesystem::getUuid ( )

Get the UUID of the filesystem.

See also
http://wiki.ubuntuusers.de/UUID
Returns
Returns the UUID of the filesystem, otherwise an empty string.

Implements OMV\System\Filesystem\IFilesystem.

◆ grow()

OMV\System\Filesystem\Filesystem::grow ( )

Grow the filesystem.

Returns
None.

Implements OMV\System\Filesystem\IFilesystem.

◆ hasDeviceFileById()

OMV\System\Filesystem\Filesystem::hasDeviceFileById ( )

Check whether the filesystem 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\Filesystem\IFilesystem.

◆ hasDeviceFileByLabel()

OMV\System\Filesystem\Filesystem::hasDeviceFileByLabel ( )

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

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

Implements OMV\System\Filesystem\IFilesystem.

◆ hasDeviceFileByUuid()

OMV\System\Filesystem\Filesystem::hasDeviceFileByUuid ( )

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

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

Implements OMV\System\Filesystem\IFilesystem.

◆ hasFileSystem()

static OMV\System\Filesystem\Filesystem::hasFileSystem (   $deviceFile)
static

Check if the given device file contains a file system.

Parameters
deviceFileThe devicefile to check, e.g. /dev/sda.
Returns
TRUE if the devicefile has a file system, otherwise FALSE.

◆ hasLabel()

OMV\System\Filesystem\Filesystem::hasLabel ( )

Check if the filesystem has a label.

Returns
Returns TRUE if the filesystem has a label, otherwise FALSE.

Implements OMV\System\Filesystem\IFilesystem.

◆ hasMultipleDevices()

OMV\System\Filesystem\Filesystem::hasMultipleDevices ( )

Check if the filesystem is a multi-device filesystem, e.g. (BTRFS).

Returns
Returns TRUE if the filesystem has multiple devices, otherwise FALSE.

◆ hasUuid()

OMV\System\Filesystem\Filesystem::hasUuid ( )

Check if the filesystem has an UUID, e.g.

78b669c1-9183-4ca3-a32c-80a4e2c61e2d (EXT2/3/4, JFS, XFS)

Implements OMV\System\Filesystem\IFilesystem.

◆ isMounted()

OMV\System\Filesystem\Filesystem::isMounted ( )

Check if a filesystem is mounted.

Returns
TRUE if the filesystem is mounted, otherwise FALSE.
Exceptions

Implements OMV\System\Filesystem\IFilesystem.

◆ mount()

OMV\System\Filesystem\Filesystem::mount (   $options = "",
  $dir = "" 
)

Mount the filesystem by its device file or UUID.

Parameters
optionsAdditional mount options as array or string. Defaults to "".
dirThe optional mount directory. Defaults to "".
Returns
None.
Exceptions

◆ refresh()

OMV\System\Filesystem\Filesystem::refresh ( )

Refresh the cached information.

Returns
None.

◆ remove()

OMV\System\Filesystem\Filesystem::remove ( )

Remove the filesystem.

Returns
None.
Exceptions

Implements OMV\System\Filesystem\IFilesystem.

◆ setBackend()

OMV\System\Filesystem\Filesystem::setBackend ( Backend\BackendAbstract  $backend)
final

Set the backend of this filesystem.

◆ shrink()

OMV\System\Filesystem\Filesystem::shrink ( )

Shrink the filesystem.

Returns
None.

Implements OMV\System\Filesystem\IFilesystem.

◆ umount()

OMV\System\Filesystem\Filesystem::umount (   $force = FALSE,
  $lazy = FALSE 
)

Unmount the filesystem.

Parameters
forceSet to TRUE to force unmount. Defaults to FALSE.
lazySet to TRUE to lazy unmount. Defaults to FALSE.
Returns
None.
Exceptions

Implements OMV\System\Filesystem\IFilesystem.


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