Documentation

lvol - Configure LVM logical volumes

Synopsis

This module creates, removes or resizes logical volumes.

Options

parameter required default choices comments
force
(added in 1.5)
no no
  • yes
  • no
Shrink or remove operations of volumes requires this switch. Ensures that that filesystems get never corrupted/destroyed by mistake.
lv
yes
    The name of the logical volume.
    opts
    (added in 2.0)
    no
      Free-form options to be passed to the lvcreate command
      size
      no
        The size of the logical volume, according to lvcreate(8) --size, by default in megabytes or optionally with one of [bBsSkKmMgGtTpPeE] units; or according to lvcreate(8) --extents as a percentage of [VG|PVS|FREE]; Float values must begin with a digit. Resizing using percentage values was not supported prior to 2.1.
        snapshot
        (added in 2.1)
        no
          The name of the snapshot volume
          state
          no present
          • present
          • absent
          Control if the logical volume exists. If present the size option is required.
          vg
          yes
            The volume group this logical volume is part of.

            Examples

            # Create a logical volume of 512m.
            - lvol: vg=firefly lv=test size=512
            
            # Create a logical volume of 512g.
            - lvol: vg=firefly lv=test size=512g
            
            # Create a logical volume the size of all remaining space in the volume group
            - lvol: vg=firefly lv=test size=100%FREE
            
            # Create a logical volume with special options
            - lvol: vg=firefly lv=test size=512g opts="-r 16"
            
            # Extend the logical volume to 1024m.
            - lvol: vg=firefly lv=test size=1024
            
            # Extend the logical volume to consume all remaining space in the volume group
            - lvol: vg=firefly lv=test size=+100%FREE
            
            # Extend the logical volume to take all remaining space of the PVs
            - lvol: vg=firefly lv=test size=100%PVS
            
            # Resize the logical volume to % of VG
            - lvol: vg-firefly lv=test size=80%VG force=yes
            
            # Reduce the logical volume to 512m
            - lvol: vg=firefly lv=test size=512 force=yes
            
            # Remove the logical volume.
            - lvol: vg=firefly lv=test state=absent force=yes
            
            # Create a snapshot volume of the test logical volume.
            - lvol: vg=firefly lv=test snapshot=snap1 size=100m
            

            Notes

            Note

            Filesystems on top of the volume are not resized.

            This is an Extras Module

            For more information on what this means please read Extras Modules

            For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Helping Testing PRs and Developing Modules.