Module for managing disks and blockdevices
Return block device attributes: UUID, LABEL, etc. This function only works on systems where blkid is available.
Device name from the system
Any valid token used for the search
CLI Example:
salt '*' disk.blkid
salt '*' disk.blkid /dev/sda
salt '*' disk.blkid token='UUID=6a38ee5-7235-44e7-8b22-816a403bad5d'
salt '*' disk.blkid token='TYPE=ext4'
Return all contents of dumpe2fs for a specified device
CLI Example:
salt '*' disk.dump /dev/sda1
Format a filesystem onto a device
New in version 2016.11.0.
The device in which to create the new filesystem
The type of filesystem to create
Size of the inodes
This option is only enabled for ext and xfs filesystems
If enabled and the uninit_bg feature is enabled, the inode table will not be fully initialized by mke2fs. This speeds up filesystem initialization noticeably, but it requires the kernel to finish initializing the filesystem in the background when the filesystem is first mounted. If the option value is omitted, it defaults to 1 to enable lazy inode table zeroing.
This option is only enabled for ext filesystems
FAT size option. Can be 12, 16 or 32, and can only be used on fat or vfat filesystems.
Force mke2fs to create a filesystem, even if the specified device is not a partition on a block special device. This option is only enabled for ext and xfs filesystems
This option is dangerous, use it with caution.
CLI Example:
salt '*' disk.format /dev/sdX1
Return the filesystem name of the specified device
New in version 2016.11.0.
The name of the device
CLI Example:
salt '*' disk.fstype /dev/sdX1
Return the filesystem type of the underlying device for a specified path.
New in version 3006.0.
The path for the function to evaluate.
CLI Example:
salt '*' disk.get_fstype_from_path /root
Retrieve all info's for all disks parse 'em into a nice dict (which, considering hdparms output, is quite a hassle)
New in version 2016.3.0.
CLI Example:
salt '*' disk.hdparms /dev/sda
Get/set Host Protected Area settings
T13 INCITS 346-2001 (1367D) defines the BEER (Boot Engineering Extension Record) and PARTIES (Protected Area Run Time Interface Extension Services), allowing for a Host Protected Area on a disk.
It's often used by OEMS to hide parts of a disk, and for overprovisioning SSD's
Warning
Setting the HPA might clobber your data, be very careful with this on active disks!
New in version 2016.3.0.
CLI Example:
salt '*' disk.hpa /dev/sda
salt '*' disk.hpa /dev/sda 5%
salt '*' disk.hpa /dev/sda 10543256
Return inode usage information for volumes mounted on this minion
CLI Example:
salt '*' disk.inodeusage
Gather and return (averaged) IO stats.
New in version 2016.3.0.
Changed in version 2016.11.4: Added support for AIX
CLI Example:
salt '*' disk.iostat 1 5 disks=sda
Return partition information for volumes mounted on this minion
CLI Example:
salt '*' disk.percent /var
Resizes the filesystem.
CLI Example:
salt '*' disk.resize2fs /dev/sda1
Fetch SMART attributes Providing attributes will deliver only requested attributes Providing values will deliver only requested values for attributes
Default is the Backblaze recommended set (https://www.backblaze.com/blog/hard-drive-smart-stats/): (5,187,188,197,198)
New in version 2016.3.0.
CLI Example:
salt '*' disk.smart_attributes /dev/sda
salt '*' disk.smart_attributes /dev/sda attributes=(5,187,188,197,198)
Set attributes for the specified device
CLI Example:
salt '*' disk.tune /dev/sda1 read-ahead=1024 read-write=True
Valid options are: read-ahead
, filesystem-read-ahead
,
read-only
, read-write
.
See the blockdev(8)
manpage for a more complete description of these
options.
Return usage information for volumes mounted on this minion
Changed in version 2019.2.0: Default for SunOS changed to 1 kilobyte blocks
CLI Example:
salt '*' disk.usage
Remove the filesystem information
CLI Example:
salt '*' disk.wipe /dev/sda1