OpenMediaVault  3.0 (Erasmus)
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 ()
 
 getPreferredDeviceFile ()
 
 getDeviceFiles ()
 
 hasMultipleDevices ()
 
 getBlockSize ()
 
 grow ()
 
 shrink ()
 
 remove ()
 
 getMountPoint ()
 
 getStatistics ()
 
 isMounted ()
 
 mount ($options="")
 
 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 ()
 
 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 ()
 
 getDeviceFileSymlinks ()
 
 getSize ()
 

Static Public Member Functions

static isMountPoint ($dir)
 
static buildMountPath ($uuid)
 
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

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

Member Function Documentation

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

Assert that the filesystem has a label.

Returns
None.
Exceptions
OMV\System\Filesystem\Filesystem::assertUuid ( )

Assert that the filesystem has an UUID.

Returns
None.
Exceptions
static OMV\System\Filesystem\Filesystem::buildMountPath (   $uuid)
static

Get the directory where the filesystem should be mounted to. Note, this path is OMV specific: /media/<FSUUID>.

Parameters
uuidThe UUID of the filesystem.
Returns
The path where to mount the filesystem, e.g. /media/85732966-949a-4d8b-87d7-d7e6681f787e.
OMV\System\Filesystem\Filesystem::exists ( )

Checks if the filesystem exists.

Returns
TRUE if the device exists, otherwise FALSE.

Implements OMV\System\Filesystem\IFilesystem.

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

Get the backend of this filesystem.

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

Get the filesystem block size.

Returns
The block size.
Exceptions

Implements OMV\System\IBlockDevice.

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

Get the filesystem detailed information.

Returns
None.
Exceptions
OMV\System\Filesystem\Filesystem::getDescription ( )

Get the description of the file system.

Returns
The file system description.

Implements OMV\System\Filesystem\IFilesystem.

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.

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.

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.

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.

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.

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

Get all available/detected filesystems.

Returns
An array of Filesystem objects.
Exceptions
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.
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.
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.

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

Get the mount point of the given filesystem.

Returns
The mountpoint of the filesystem or FALSE.
Exceptions
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.

Implements OMV\System\Filesystem\IFilesystem.

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.
OMV\System\Filesystem\Filesystem::getPartitionScheme ( )

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

Returns
The filesystem type.
OMV\System\Filesystem\Filesystem::getPartitionType ( )

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

Deprecated:
Returns
The filesystem type, otherwise FALSE.
OMV\System\Filesystem\Filesystem::getPreferredDeviceFile ( )

Get the special device file to present in the UI instead of the value of the getDeviceFile method. Get the special device file in the following preferred order:

/dev/disk/by-label/xxx

  • /dev/disk/by-uuid/xxx
  • /dev/disk/by-id/xxx
  • /dev/xxx
    Returns
    Returns the device file.

Implements OMV\System\Filesystem\IFilesystem.

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
OMV\System\Filesystem\Filesystem::getType ( )

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

Returns
The filesystem type.

Implements OMV\System\Filesystem\IFilesystem.

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

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

Returns
The filesystem usage.
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.

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

Grow the filesystem.

Returns
None.

Implements OMV\System\Filesystem\IFilesystem.

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\IBlockDevice.

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.
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.
static OMV\System\Filesystem\Filesystem::hasFileSystem (   $deviceFile)
static

Check if the given device file contains a file system.

Parameters
deviceFileThe devicefile to check.
Returns
TRUE if the devicefile has a file system, otherwise FALSE.
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.

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.
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.

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.

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

See if a directory is a mountpoint.

Parameters
dirThe directory path to check.
Returns
TRUE if the directory is a mountpoint, otherwise FALSE.
OMV\System\Filesystem\Filesystem::mount (   $options = "")

Mount the filesystem by its device file or UUID.

Parameters
optionsAdditional mount options. Defaults to "".
Returns
None.
Exceptions

Implements OMV\System\Filesystem\IFilesystem.

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

Refresh the cached information.

Returns
None.
OMV\System\Filesystem\Filesystem::remove ( )

Remove the filesystem.

Returns
None.
Exceptions

Implements OMV\System\Filesystem\IFilesystem.

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

Set the backend of this filesystem.

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

Shrink the filesystem.

Returns
None.

Implements OMV\System\Filesystem\IFilesystem.

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: