lvm on linux

asked 2016-12-15 20:02:51 -0500

ggun gravatar image

updated 2016-12-15 23:38:54 -0500

lupin gravatar image

hi ,

Thank you for the help in advanced. I have a question related to this module .

https://forge.puppet.com/puppetlabs/lvm

I am using this module to create the logical volume, create the volume group and mount the filesystem. I have added this module in the puppet file and below is the code that I am using to create the required volume group, logical volume and filesystem. This works very well but when I restart my server after configuring the disk through the below code , I am not able to login back to the server this has happened second time in row. Below is the code for the lvm There are two physical volume that is created as vgroot and vgapp from thr physical disk /dev/xvdm1 and /dev/xvdl1 . PLease help me in finding this issue

class profile::glic_wasnd::glic_wasbase::lvmmanage {
  $ppvroot     =  '/dev/xvdm1'
  $pvgroot     =  'vg_root'

  $plvrootmwd  =  'mwadmin'
  $pfsrootmwd  =  "/dev/${pvgroot}/$plvrootmwd"
  $pfshumreadrootmwd = '/home/mwadmin'

  $plvroottemp  =  'temp'
  $pfsroottemp =  "/dev/${pvgroot}/${plvroottemp}"
  $pfshumreadroottemp = '/tmp'

  $pfstype    =  'ext4'
  $poptions   =  'defaults'
  $pfixed_pass  = '1'
  $pfixed_dump  = '1'

  $ppvapp     =  '/dev/xvdl1'
  $pvgapp     =  'vg_app'

  $plvappihs  =  'ihs'
  $pfsappihs =  "/dev/${pvgapp}/${plvappihs}"
  $pfshumreadapptihs = "/opt/${plvappihs}"

  $plvappwas  =  'was'
  $pfsappwas =  "/dev/${pvgapp}/${plvappwas}"
  $pfshumreadapptwas = "/opt/${plvappwas}"

  $plvapplogr  =  'logr'
  $pfsapplogr =  "/dev/${pvgapp}/${plvapplogr}"
  $pfshumreadapptlogr = "/${plvapplogr}"



#Step 1 Create the root vg group

  physical_volume { $ppvroot :
    ensure      =>  present,
    unless_vg   =>  "$pvgroot",
  }

  volume_group { $pvgroot :
    ensure           => present,
    physical_volumes => "$ppvroot",
    createonly       =>  true,
    require           => Physical_volume[$ppvroot] ,
  }

# Step for the adding the mwadmin in vg root


  logical_volume { $plvrootmwd :
    ensure       => present,
    volume_group => "$pvgroot",
    size         => '5G',
    require       => Volume_group[$pvgroot],
  }

  filesystem { $pfsrootmwd :
    ensure   => present,
    fs_type  => 'ext4',
    options  => '-b 4096 -E stride=32,stripe-width=64',
    require  =>  Logical_volume[$plvrootmwd],
  }

  mount { $pfshumreadrootmwd : 
    ensure    =>  mounted,
    name     =>   $pfshumreadrootmwd,
    device    =>  $pfsrootmwd ,
    fstype     => "${pfstype}",    
    options => $poptions,
    pass    => $pfixed_pass,
    dump    => $pfixed_dump,
    atboot  => true,
    require => Filesystem[$pfsrootmwd] ,
  }



# Step for the adding the temp in vg root


   logical_volume { $plvroottemp :
    ensure       => present,
    volume_group => "$pvgroot",
    size         => '5G',
    require       => Volume_group[$pvgroot],
   }

  filesystem { $pfsroottemp:
    ensure   => present,
    fs_type  => 'ext4',
    options  => '-b 4096 -E stride=32,stripe-width=64',
    require  =>  Logical_volume[$plvroottemp],
  }

  mount { $pfshumreadroottemp : 
    ensure    =>  mounted,
    name     =>   $pfshumreadroottemp,
    device    =>  $pfsroottemp ,
    fstype     => "${pfstype}",    
    options => $poptions,
    pass    => $pfixed_pass,
    dump    => $pfixed_dump,
    atboot  => true,
    require => Filesystem[$pfsroottemp] ,
  }



# Step 2 - For vg-app

  physical_volume { $ppvapp :
  ensure      =>  present,
  unless_vg   =>  "$pvgapp",
  }

  volume_group { $pvgapp :
  ensure           => present,
  physical_volumes => "$ppvapp",
  createonly       =>  true,
  require           => Physical_volume[$ppvapp] ,
  }

# Step for the adding the ihs in vg app


  logical_volume { $plvappihs :
  ensure       => present,
  volume_group => "$pvgapp",
  size         => '4G',
  require       => Volume_group[$pvgapp],
  }

  filesystem { $pfsappihs:
    ensure  => present,
    fs_type => 'ext4',
    options => '-b 4096 -E stride=32,stripe-width=64',
    require       => Logical_volume[$plvappihs],
  }


  mount { $pfshumreadapptihs : 
    ensure    =>  mounted,
    name     =>   $pfshumreadapptihs,
    device    =>  $pfsappihs ,
    fstype     => "${pfstype}",    
    options => $poptions,
    pass    => $pfixed_pass,
    dump    => $pfixed_dump,
    atboot  => true,
    require => Filesystem[$pfsappihs] ,
  }


# Step for the adding the was in vg app

  logical_volume { $plvappwas :
  ensure       => present,
  volume_group => "$pvgapp",
  size         => '20G',
  require       => Volume_group[$pvgapp],
  }

  filesystem { $pfsappwas:
    ensure  => present,
    fs_type => 'ext4',
    options => '-b 4096 -E stride=32,stripe-width=64',
    require       => Logical_volume[$plvappwas],
  }

  mount { $pfshumreadapptwas : 
    ensure    =>  mounted,
    name     =>   $pfshumreadapptwas,
    device    =>  $pfsappwas ,
    fstype     => "${pfstype}",    
    options => $poptions,
    pass    => $pfixed_pass,
    dump    => $pfixed_dump,
    atboot  => true,
    require => Filesystem[$pfsappwas] ,
  }


# Step for the adding the logr in vg app

  logical_volume { $plvapplogr :
  ensure       => present,
  volume_group => "$pvgapp",
  size         => '10G ...
(more)
edit retag flag offensive close merge delete

Comments

1

Why do you think that the your code could keep you from logging in to your system after it is rebooted?

Red Cricket gravatar imageRed Cricket ( 2016-12-16 00:00:02 -0500 )edit

Bcoz when I did the changes manually and restart the server then there is not problem but when I run above piece of code and after that I restart the server I am Not able to login to the server with my id it is saying access denied. Test 1. Id is not locked 2. no one else even admin not able to log

ggun gravatar imageggun ( 2016-12-16 08:22:47 -0500 )edit

Ops team found the problem- That the filesytem /tmp access was changed to 775 instead of 1777. Second problem is the /opt fs got fulled couldn't understand this part. Need to check on this. Though the /opt original side is 30G why it is getting fulled even if other sytem has same configuration

ggun gravatar imageggun ( 2016-12-16 08:55:52 -0500 )edit

Issue resolved: Third party tool was taking the space on /opt. The solution for problem one is to change the /tmp access to 1777

ggun gravatar imageggun ( 2016-12-16 11:22:32 -0500 )edit