Page 4 of 23
This section contains functions to manipulate disks and block devices.
disk_category
Get category of content for a given disk device
Arguments
$1 | Device path |
Returns
Always 0Displays
'fs' if it is a filesystem 'swap' if it is a swap partition else, the type returned by disk_type()disk_fs_size
Get the size of a file system (from device name)
File system can be mounted or not.
Note: In order to get the size of a mounted filesystem containing a given path, use fs_size.
Arguments
$1 | Device |
Returns
0 if dev exists and contains a FS, else !=0.Displays
FS size in bytes. If the device does not exist or does not contain a FS, displays nothing.disk_normalize_device
Normalize a disk device name
After being normalized, device names can be compared.
Input can be in the form:
- /dev/<vg>/<lv> - /dev/mapper/... - /dev/<partition or disk> (as /dev/sda1) - LABEL=xxx - UUID=xxx
Output is in the form:
- /dev/<vg>/<lv> if LVM logical volume - /dev/<physical> if physical disk - Copy of input if input was not recognised
Arguments
$1 | Device name to normalize |
Returns
0 if device exists, 1 if notDisplays
Normalized name if device exists, copy of input if notdisk_rescan
Scan and discover new SCSI devices
Calling program should wait between 5 and 10 seconds for new devices to be discovered.
Arguments
None
Returns
Always 0Displays
Nothingdisk_type
Returns type of content for a given disk device
Arguments
$1 | Device path |