Ask Your Question
0

puppetlabs/lvm how to resize a logical volume and it's file system

asked 2017-03-06 16:44:28 -0500

jrbast gravatar image

updated 2017-05-14 20:28:35 -0500

DarylW gravatar image

Can anyone help on what is needed to resize an existing volume and file system using the puppetlabs/lmv module?

My current manifest looks like this...

  logical_volume { $volname:
    ensure       => present,
    volume_group => $vgname,
    size         => $size,
  }
  filesystem { "/dev/mapper/${vgname}-${volname}":
    ensure  => present,
    fs_type => $fstype,
    require => Logical_volume[$volname],
  }
  exec { $mount:
    path      => '/bin:/sbin:/usr/bin:/usr/sbin',
    command   => "mkdir -p ${mount}",
    logoutput => true,
    creates   => $mount,
  }
  mount { $mount:
    ensure   => mounted,
    atboot   => true,
    device   => "/dev/mapper/${vgname}-${volname}",
    fstype   => $fstype,
    remounts => true,
    require  => [Exec[$mount],Logical_volume[$volname]],
  }
  file { $mount:
    ensure  => directory,
    owner   => $owner,
    group   => $group,
    mode    => $mode,
    require => Mount[$mount],
 }
edit retag flag offensive close merge delete

Comments

Why are you using Exec to create a directory?

puser gravatar imagepuser ( 2017-05-16 06:18:23 -0500 )edit

I'm assuming that is because puppet doesn't have a reasonable alternative to mkdir -p due to it's potentially non-idempotent results, though there are some tools to help with it - https://forge.puppet.com/pltraining/dirtree

DarylW gravatar imageDarylW ( 2017-05-16 09:26:32 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-05-16 07:04:56 -0500

jrbast gravatar image

This is resolved. I used facts to determine the existing device name, using it in place of creating new, passing the size variable from hiera with a default. also placing the parameter of sizeisminsize => true,

logicalvolume { $usevol: ensure => present, volumegroup => $vgname, resizefs => true, sizeis_minsize => true, size => $size, extents => undef, }

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-03-06 16:44:28 -0500

Seen: 247 times

Last updated: May 16