Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

lvm (106) Versions 4.1.6

Installs and manages Logical Volume Manager

Policyfile
Berkshelf
Knife
cookbook 'lvm', '= 4.1.6', :supermarket
cookbook 'lvm', '= 4.1.6'
knife supermarket install lvm
knife supermarket download lvm
README
Dependencies
Changelog
Quality 100%

lvm Cookbook

Build Status Cookbook Version

Installs lvm2 package and includes resources for managing LVM.

Note on LVM gems

This cookbook has used multiple variants of the ruby-lvm and ruby-lvm-attrib gems for interacting with LVM. Most recently we used di-ruby-lvm and di-ruby-lvm-attrib gems, which are no longer being maintained. As of the 4.0 release this cookbook uses new Chef maintained gems: chef-ruby-lvm and chef-ruby-lvm-attrib. The cookbook will first remove the old gems before load/installing the new gems, in order to prevent gem conflicts. If you previously used attributes to control the version of the gems to install, you will need to update to the latest attribute names to maintain that functionality.

Requirements

Platforms

  • Debian/Ubuntu
  • RHEL/CentOS/Scientific/Amazon/Oracle

Chef

  • Chef 12.1+

Cookbooks

  • none

Resources/Providers

lvm_physical_volume

Manages LVM physical volumes.

Actions

Action Description
:create (default) Creates a new physical volume
:resize Resize an existing physical volume

Parameters

Parameter Description Example Default
name (required) The device to create the new physical volume on /dev/sda
wipe_signatures Force the creation of the Logical Volume, even if lvm detects existing PV signatures/td> true false

Examples

lvm_physical_volume '/dev/sda'

lvm_logical_volume

Manages LVM logical volumes.

Actions

Action Description
:create (default) Creates a new logical volume
:resize Resize an existing logical volume

Parameters

<table>
<tr>
<th>Attribute</th>
<th>Description</th>
<th>Example</th>
<th>Default</th>
</tr>
<tr>
<td>name</td>
<td>(name attribute) Name of the logical volume</td>
<td><tt>bacon</tt></td>
<td></td>
</tr>
<tr>
<td>group</td>
<td>(required) Volume group in which to create the new volume (not required if the volume is declared inside of an lvm_volume_group block)</td>
<td><tt>bits</tt></td>
<td></td>
</tr>
<tr>
<td>size</td>
<td>(required) Size of the volume.
<ul>
<li>It can be the size of the volume with units (k, K, m, M, g, G, t, T)</li>
<li>It can be specified as the percentage of the size of the volume group</li>
</ul>
</td>
<td>
<ul>
<li><tt>10G</tt></li>
<li><tt>25%VG</tt></li>
</ul>
</td>
<td></td>
</tr>
<tr>
<td>filesystem</td>
<td>The format for the file system</td>
<td><tt>'ext4'</tt></td>
<td></td>
</tr>
<tr>
<td>filesystem_params</td>
<td>Optional parameters to use when formatting the file system</td>
<td><tt>'-j -L log -m 2 -i 10240 -J size=400 -b 4096'</tt></td>
<td></td>
</tr>
<tr>
<td>mount_point</td>
<td>
Either a String containing the path to the mount point, or a Hash with the following keys:
<ul>
<li>driver:
name: dokken
privileged: true # because Docker and SystemD/Upstart
chef_version: current - (required) the directory to mount the volume on</li>
<li><tt>options</tt> - the mount options for the volume</li>
<li><tt>dump</tt> - the <tt>dump</tt> field for the fstab entry</li>
<li><tt>pass</tt> - the <tt>pass</tt> field for the fstab entry</li>
</ul>
</td>
<td><tt>'/var/my/mount'</tt></td>
<td></td>
</tr>
<tr>
<td>physical_volumes</td>
<td>Array of physical volumes that the volume will be
restricted to</td>
<td><tt>['/dev/sda', '/dev/sdb']</tt></td>
<td></td>
</tr>
<tr>
<td>stripes</td>
<td>Number of stripes for the volume</td>
<td><tt>5</tt></td>
<td></td>
</tr>
<tr>
<td>stripe_size</td>
<td>Number of kilobytes per stripe segment (must be a power of 2 less than or equal to the physical extent size for the volume group)</td>
<td><tt>24</tt></td>
<td></td>
</tr>
<tr>
<td>mirrors</td>
<td>Number of mirrors for the volume</td>
<td><tt>5</tt></td>
<td></td>
</tr>
<tr>
<td>contiguous</td>
<td>Whether or not volume should use the contiguous allocation
policy</td>
<td><tt>true</tt></td>
<td><tt>false</tt></td>
</tr>
<tr>
<td>readahead</td>
<td>The readahead sector count for the volume (can be a value
between 2 and 120, 'auto', or 'none')</td>
<td><tt>'auto'</tt></td>
<td></td>
</tr>
<td>take_up_free_space</td>
<td>whether to have the LV take up the remainder of free space on the VG. Only valid for resize action</td>
<td><tt>true</tt></td>
<td>false</td>
</tr>
<tr>
<td>wipe_signatures</td>
<td>Force the creation of the Logical Volume, even if lvm detects existing LV signatures/td>
<td>true</td>
<td>false</td>
</tr>
</table>

Examples

lvm_logical_volume 'home' do
  group       'vg00'
  size        '25%VG'
  filesystem  'ext4'
  mount_point '/home'
  stripes     3
  mirrors     2
end

lvm_thin_pool

Manages LVM thin pools (which are simply logical volumes created with the --thinpool argument to lvcreate).

Actions

<table>
<tr>
<th>Action</th>
<th>Description</th>
</tr>
<tr>
<td>:create</td>
<td>(default) Create a new thin pool logical volume</td>
</tr>
<tr>
<td>:resize</td>
<td>Resize an existing thin pool logical volume</td>
</tr>
</table>

Parameters

<table>
<tr>
<th>Attribute</th>
<th>Description</th>
<th>Example</th>
<th>Default</th>
</tr>
<tr>
<td>name</td>
<td>(name attribute) Name of the logical volume</td>
<td><tt>bacon</tt></td>
<td></td>
</tr>
<tr>
<td>group</td>
<td>(required) Volume group in which to create the new volume (not required if the volume is declared inside of an lvm_volume_group block)</td>
<td><tt>bits</tt></td>
<td></td>
</tr>
<tr>
<td>size</td>
<td>(required) Size of the volume.
<ul>
<li>It can be the size of the volume with units (k, K, m, M, g, G, t, T)</li>
<li>It can be specified as the percentage of the size of the volume group</li>
</ul>
</td>
<td>
<ul>
<li><tt>10G</tt></li>
<li><tt>25%VG</tt></li>
</ul>
</td>
<td></td>
</tr>
<tr>
<td>filesystem</td>
<td>The format for the file system</td>
<td><tt>'ext4'</tt></td>
<td></td>
</tr>
<tr>
<td>filesystem_params</td>
<td>Optional parameters to use when formatting the file system</td>
<td><tt>'-j -L log -m 2 -i 10240 -J size=400 -b 4096'</tt></td>
<td></td>
</tr>
<tr>
<td>mount_point</td>
<td>
Either a String containing the path to the mount point, or a Hash with the following keys:
<ul>
<li>driver:
name: dokken
privileged: true # because Docker and SystemD/Upstart
chef_version: current - (required) the directory to mount the volume on</li>
<li><tt>options</tt> - the mount options for the volume</li>
<li><tt>dump</tt> - the <tt>dump</tt> field for the fstab entry</li>
<li><tt>pass</tt> - the <tt>pass</tt> field for the fstab entry</li>
</ul>
</td>
<td><tt>'/var/my/mount'</tt></td>
<td></td>
</tr>
<tr>
<td>physical_volumes</td>
<td>Array of physical volumes that the volume will be
restricted to</td>
<td><tt>['/dev/sda', '/dev/sdb']</tt></td>
<td></td>
</tr>
<tr>
<td>stripes</td>
<td>Number of stripes for the volume</td>
<td><tt>5</tt></td>
<td></td>
</tr>
<tr>
<td>stripe_size</td>
<td>Number of kilobytes per stripe segment (must be a power of 2 less than or equal to the physical extent size for the volume group)</td>
<td><tt>24</tt></td>
<td></td>
</tr>
<tr>
<td>mirrors</td>
<td>Number of mirrors for the volume</td>
<td><tt>5</tt></td>
<td></td>
</tr>
<tr>
<td>contiguous</td>
<td>Whether or not volume should use the contiguous allocation
policy</td>
<td><tt>true</tt></td>
<td><tt>false</tt></td>
</tr>
<tr>
<td>readahead</td>
<td>The readahead sector count for the volume (can be a value
between 2 and 120, 'auto', or 'none')</td>
<td><tt>'auto'</tt></td>
<td></td>
</tr>
<td>take_up_free_space</td>
<td>whether to have the LV take up the remainder of free space on the VG. Only valid for resize action</td>
<td><tt>true</tt></td>
<td>false</td>
</tr>
<tr>
<td>thin_volume</td>
<td>Shortcut for creating a new lvm_thin_volume definition (the volumes will be created in the order they are declared)</td>
<td></td>
<td></td>
</tr>
</table>


lvm_thin_volume

Manages LVM thin volumes (which are simply logical volumes created with the --thin argument to lvcreate and are contained inside of
other logical volumes that were created with the --thinpool option to lvcreate).

Actions

<table>
<tr>
<th>Action</th>
<th>Description</th>
</tr>
<tr>
<td>:create</td>
<td>(default) Create a new thin logical volume</td>
</tr>
<tr>
<td>:resize</td>
<td>Resize an existing thin logical volume</td>
</tr>
</table>

Parameters

<table>
<tr>
<th>Attribute</th>
<th>Description</th>
<th>Example</th>
<th>Default</th>
</tr>
<tr>
<td>name</td>
<td>(name attribute) Name of the logical volume</td>
<td><tt>bacon</tt></td>
<td></td>
</tr>
<tr>
<td>group</td>
<td>(required) Volume group in which to create the new volume (not required if the volume is declared inside of an lvm_volume_group block)</td>
<td><tt>bits</tt></td>
<td></td>
</tr>
<tr>
<td>pool</td>
<td>(required) Thin pool volume in which to create the new volume (not required if the volume is declared inside of an lvm_thin_pool block)</td>
<td><tt>bits</tt></td>
<td></td>
</tr>
<tr>
<td>size</td>
<td>(required) Size of the volume.
<ul>
<li>It can be the size of the volume with units (k, K, m, M, g, G, t, T)</li>
</ul>
</td>
<td>
<ul>
<li><tt>10G</tt></li>
</ul>
</td>
<td></td>
</tr>
<tr>
<td>filesystem</td>
<td>The format for the file system</td>
<td><tt>'ext4'</tt></td>
<td></td>
</tr>
<tr>
<td>filesystem_params</td>
<td>Optional parameters to use when formatting the file system</td>
<td><tt>'-j -L log -m 2 -i 10240 -J size=400 -b 4096'</tt></td>
<td></td>
</tr>
<tr>
<td>mount_point</td>
<td>
Either a String containing the path to the mount point, or a Hash with the following keys:
<ul>
<li>driver:
name: dokken
privileged: true # because Docker and SystemD/Upstart
chef_version: current - (required) the directory to mount the volume on</li>
<li><tt>options</tt> - the mount options for the volume</li>
<li><tt>dump</tt> - the <tt>dump</tt> field for the fstab entry</li>
<li><tt>pass</tt> - the <tt>pass</tt> field for the fstab entry</li>
</ul>
</td>
<td><tt>'/var/my/mount'</tt></td>
<td></td>
</tr>
</table>

Examples

lvm_thin_volume 'thin01' do
  group       'vg00'
  pool        'lv-thin-pool'
  size        '5G'
  filesystem  'ext4'
  mount_point location: '/var/thin01', options: 'noatime,nodiratime'
end

lvm_volume_group

Manages LVM volume groups.

Actions

Action Description
:create (default) Creates a new volume group
:extend Extend an existing volume group to include new physical volumes

Parameters

Attribute Description Example Default
name (required) Name of the volume group <tt>'bacon'</tt>
physical_volumes (required) The device or list of devices to use as physical volumes (if they haven't already been initialized as physical volumes, they will be initialized automatically) <tt>['/dev/sda', '/dev/sdb']</tt>
physical_extent_size The physical extent size for the volume group
logical_volume Shortcut for creating a new lvm_logical_volume definition (the logical volumes will be created in the order they are declared)
wipe_signatures Force the creation of the Volume Group, even if lvm detects existing non-LVM data on disk true false
thin_pool Shortcut for creating a new lvm_thin_pool definition (the logical volumes will be created in the order they are declared)

Examples

lvm_volume_group 'vg00' do
  physical_volumes ['/dev/sda', '/dev/sdb', '/dev/sdc']
  wipe_signatures true

  logical_volume 'logs' do
    size        '1G'
    filesystem  'xfs'
    mount_point location: '/var/log', options: 'noatime,nodiratime'
    stripes     3
  end

  logical_volume 'home' do
    size        '25%VG'
    filesystem  'ext4'
    mount_point '/home'
    stripes     3
    mirrors     2
  end

  thin_pool "lv-thin-pool" do
    size '5G'
    stripes 2

    thin_volume "thin01" do
      size '10G'
      filesystem  'ext4'
      mount_point location: '/var/thin01', options: 'noatime,nodiratime'
    end
  end
end

Usage

Include the default recipe in your run list on a node, in a role, or in another recipe:

run_list(
  'recipe[lvm::default]'
)

Depend on lvm in any cookbook that uses its Resources/Providers:

# other_cookbook/metadata.rb
depends 'lvm'

Caveats

This cookbook depends on the chef-ruby-lvm and chef-ruby-lvm-attrib gems. The chef-ruby-lvm-attrib gem in particular is a common cause of failures when using the providers. If you get a failure with an error message similar to

No such file or directory - /opt/chef/.../chef-ruby-lvm-attrib-0.0.3/lib/lvm/attributes/2.02.300(2)/lvs.yaml

then you are running a version of lvm that the gems do not support. However, getting support added is usually pretty easy. Just follow the instructions on "Adding Attributes" in the chef-ruby-lvm-attrib README.

License and Authors

Copyright:: 2011-2016, Chef Software, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

bigdata Applicable Versions
chef-provisioning-aws-helper Applicable Versions
drbd Applicable Versions
ephemeral_lvm Applicable Versions
filesystem Applicable Versions
ganeti Applicable Versions
gluster Applicable Versions
maxdb Applicable Versions
open-build-service Applicable Versions
openstack-block-storage Applicable Versions
sbuild Applicable Versions
server_utils Applicable Versions
zabbix_lwrp Applicable Versions

lvm Cookbook CHANGELOG

This file is used to list changes made in each version of the lvm cookbook.

4.1.6 (2017-08-15)

  • Fix for size in extents --extents should be used

4.1.5 (2017-08-15)

  • Add missing matchers for lvm thin pools and volumes

4.1.4 (2017-06-21)

  • Require the latest lvm gem which allows for the latest attrib gem

4.1.3 (2017-06-21)

  • Require the latest chef-ruby-lvm-attrib gem to support recent distros like RHEL 7.2/7.3

4.1.2 (2017-06-20)

  • Ensure metadata parsing doesn't fail on older chef 12 releases

4.1.1 (2017-06-20)

  • Adding source for the air gaped environment use case.
  • Don't start lvm2-lvmetad on amazon linux when on Chef < 13

4.1.0 (2017-04-26)

  • Fix invalid platform sles in metadata
  • Allowing a different source for gem install

4.0.6 (2017-03-29)

  • Only cleanup gems once in a chef run

4.0.5 (2017-01-09)

  • fix false coerce float error

4.0.4 (2016-12-20)

  • Remove deprecation notices introduced in 4.0.1

4.0.3 (2016-12-19)

  • Include platformintrospection dsl to fix suse check failures

4.0.2 (2016-12-15)

  • Warn if the attributes are set vs. a hard failure
  • Document the new gem changes in the readme

4.0.1 (2016-12-14)

  • Uninstall the previous lvm gems to prevent failures installing the new chef forks

4.0.0 (2016-12-12)

Breaking changes

  • This cookbook has switched from the di-ruby-lvm/di-ruby-lvm-attrib gems to chef-ruby-lvm/chef-ruby-lvm-attrib forks. This was done to ensure that the latest lvm releases are always supported by the cookbooks and brings with it support for RHEL 7.3. If you have previously pinned gem versions you will need to update to the new attributes.

Other changes

  • Added "yes_flag" also to PV and LV create"
  • Format and reword the readme
  • Remove need for apt for testing
  • Fix Suse support if using ext filesystems by installing the e2fsprogs package if necessary

3.1.0 (2016-10-26)

  • Remove chef 11 compatibility from chef_gem install
  • Update to di-ruby-lvm-attrib 0.0.27

3.0.0 (2016-09-16)

  • Testing updates
  • update to add chefspec runner methods
  • Require Chef 12.1+

v2.1.2 (2016-06-14)

  • Prevent failures in other cookbooks utilizing the lvm resources

v2.1.1 (2016-06-10)

  • Update di-ruby-lvm-attrib to 0.0.26

v2.1.0 (2016-05-11)

  • Added lvm_thin_pool and lvm_thin_volume resources

v2.0.0 (2016-04-11)

  • The gems are now installed when the provider is first used instead of in the default recipe. For users that already have the LVM package installed there is no need to include the default recipe on their run_list now
  • Due to how the gem is installed now this recipe now requires Chef 12.0+
  • Added RHEL 7.0 specs for the default recipe

v1.6.1 (2016-03-23)

  • Fixed compile time installs of di-ruby-lvm

v1.6.0 (2016-03-23)

  • Add a wipe_signatures option to LVM volume group

v1.5.2 (2016-03-23)

  • Update di-ruby-lvm-attrib to 0.0.25

v1.5.1 (2016-01-26)

  • Added attributes to allow installing the lvm gems at compile time
  • Removed yum cookbook from the Berksfile as it wasn't being used
  • Improved testing with chefspec and test kitchen

v1.5.0 (2015-12-09)

  • Update the di-ruby-lvm and di-ruby-lvm-attrib gems to the latest release to improve speed and the supported versions of LVM
  • Add testing of the resizing to Travis CI and the Kitchen config
  • Resolve issues when running under Chefspec

v1.4.1 (2015-11-17)

  • Change chef_gem installs to not install at compile_time on Chef 12 to avoid warnings

v1.4.0 (2015-10-22)

  • Updated the minimum supported Chef release from 10 -> 11 in the readme
  • Updated di-ruby-lvm-attrib gem from 0.0.16 -> 0.0.21
  • Added Chef 11 compatibility to the source_url and issues_url in the metadata
  • Added support for additional RHEL deritivites to the metadata
  • Added additional Chefspec matchers
  • Added chefignore file to limit what files are uploaded to the Chef server
  • Added Test Kitchen config
  • Updated .gitignore
  • Updated to use Chef standard rubocop config
  • Updated Travis config to test using ChefDK vs. Gems
  • Updated contributing and testing docs
  • Added maintainers.md and maintainers.toml files
  • Updated development dependencies in the Gemfile
  • Added cookbook version badge to the readme

v1.3.7 (2015-06-20)

  • Allow users to specify the exact versions of the lvm gems (#49)
  • Start/enable the lvmetad service on RHEL7. (#52)
  • Allow arbitrary parameters to be passed to lvcreate.

v1.3.6 (2015-02-18)

  • Reverting chef_gem compile_time work

v1.3.5 (2015-02-18)

  • Fixing chef_gem with Chef::Resource::ChefGem.method_defined?(:compile_time)

v1.3.4 (2015-02-18)

  • Fixing chef_gem for Chef below 12.1.0

v1.3.3 (2015-02-17)

  • Being explicit about usage of the chef_gem's compile_time property.
  • Eliminating future deprecation warning in Chef 12.1.0

v1.3.1 (2015-02-09)

  • 46 - Unbreak cookbook on Chef Client 12
  • 34 - Add ability to specify optional filesystem parameters when formatting

v1.3.0 (2014-07-09)

  • 32 - add support for resizing logical and physical volumes
  • 33 - [COOK-4701]: add ability to extend volume groups

v1.2.2 (2014-07-02)

No changes. Bumping for toolchain

v1.2.0 (2014-07-02)

  • [COOK-2992] add support for resizing logical and physical volumes

v1.1.2 (2014-05-15)

  • [COOK-4609] Enable the logical volume if it is disabled

v1.1.0 (2014-04-10)

  • [COOK-4539] - Change default mount mode to 0755

v1.0.8 (2014-03-27)

No change. Bumping version for toolchain

v1.0.6 (2014-03-27)

  • [COOK-4486] - Add ChefSpec matchers for LVM resources
  • [COOK-4481] - The lvm_volume_group resource is not convergent

v1.0.4 (2013-12-28)

Bug

  • COOK-3987 - Volumes are created with the wrong # of extents. Size = '2%VG' is treated as a size of 2 extents.

v1.0.2

Bug

  • COOK-3935 - fix minor typo
  • Fixing up style
  • Updating test harness

v1.0.0

Improvement

  • COOK-3357 - Complete refactor into a heavy-weight provider with tests

v0.8.12

Improvement

Bug

  • COOK-2348 - Fix lvm_logical_volume when mount_point parameter is a String

v0.8.10

Bug

  • [COOK-3031]: ruby_block to create logical volume is improperly named, causing collisions

v0.8.8

  • [COOK-2283] - lvm version mismatch on fresh amazon linux install
  • [COOK-2733] - Fix invalid only_if command in lvm cookbook
  • [COOK-2822] - install, don't upgrade, lvm2 package

v0.8.6

  • [COOK-2348] - lvm logical_volume doesn't work with mount_point parameter as String

v0.8.4

  • [COOK-1977] - Typo "stripesize" in LVM cookbook
  • [COOK-1994] - Cannot create a logical volume if fstype is not given

v0.8.2

  • [COOK-1857] - lvm_logical_volume resource callback conflicts with code in provider.

v0.8.0

  • Added providers for managing the creation of LVM physical volumes, volume groups, and logical volumes.

v0.7.1

  • Current public release

Collaborator Number Metric
            

4.1.6 passed this metric

Contributing File Metric
            

4.1.6 passed this metric

Foodcritic Metric
            

4.1.6 passed this metric

License Metric
            

4.1.6 passed this metric

No Binaries Metric
            

4.1.6 passed this metric

Testing File Metric
            

4.1.6 passed this metric

Version Tag Metric
            

4.1.6 passed this metric