Cookbooks
lvm
documentation
Lvm Logical Volume

lvm_logical_volume

Back to resource list

Manages LVM logical volumes.

Actions

ActionDescription
:create(default) Creates a new logical volume
:resizeResize an existing logical volume (resizing only handles extending existing, this action will not shrink volumes due to the 'lvextend' command being passed)
:removeRemove an existing logical volume (optionally clean up the mount location/directory)

Properties

NameTypeDefaultDescription
nameStringname propertyName of the logical volume
groupString(required) Volume group in which to create the new volume (not required if the volume is declared inside of an lvm_volume_group block)
sizeString(required) Size of the volume, including units (k, K, m, M, g, G, t, T) or as the percentage of the size of the volume group
filesystemStringnilThe format for the file system
filesystem_paramsStringnilOptional parameters to use when formatting the file system
mount_pointString, HashnilEither a String containing the path to the mount point, or a Hash
physical_volumesString, Array[]Array of physical volumes that the volume will be restricted to
stripesIntegernilNumber of stripes for the volume
stripe_sizeIntegernilNumber of kilobytes per stripe segment (must be a power of 2 less than or equal to the physical extent size for the volume group)
mirrorsIntegernilNumber of mirrors for the volume
contiguoustrue, falsefalseWhether or not volume should use the contiguous allocation policy
readaheadInteger, StringnilThe readahead sector count for the volume (can be a value between 2 and 120, 'auto', or 'none')
take_up_free_spacetrue, falsefalsewhether to have the LV take up the remainder of free space on the VG. Only valid for resize action
wipe_signaturestrue, falsefalseForce the creation of the Logical Volume, even if lvm detects existing LV signatures
ignore_skipped_clustertrue, falsefalseContinue execution even if lvm detects skipped clustered volume groups
lv_paramsStringnilOptional parameters to be passed to LVM
remove_mount_pointtrue, falsefalseOptional parameter to be passed to LVM during a :remove event to clean up the directory

mount_point

If using a Hash, it must contain the following keys:

  • location - (required) the directory to mount the volume on
  • options - the mount options for the volume
  • dump - the dump field for the fstab entry
  • pass - the pass field for the fstab entry

Examples

lvm_logical_volume 'home' do
  group       'vg00'
  size        '25%VG'
  filesystem  'ext4'
  mount_point '/home'
  stripes     3
  mirrors     2
end
 
lvm_logical_volume 'test' do
  group               'vg01'
  mount_point         '/mnt/test'
  remove_mount_point  true
  action              :remove
end