Ask Your Question
1

Puppet trying to mount a disk which is already mounted

asked 2015-06-18 16:45:08 -0500

rgv gravatar image

updated 2015-06-19 17:18:18 -0500

I have puppet class to mount a disk on a mount point, if the disk is not mounted it is mounting fine, but if the disk already mounted it is still trying to mount and getting mount point busy error.

Could not evaluate: Execution of '/bin/mount -o defaults,comment=puppet /data/' returned 32: mount: /dev/xvdc is already mounted or /data busy /dev/xvdc is already mounted on /data

How does puppet check if disk is mounted or not? how to over come this issue?

Here is my class looks like:

class local_mount (
      $data_dir = hiera('data_dir','/data/') 
    ) {

      if $::ec2_block_device_mapping_ephemeral1 {
        mount { 'ephemeral_media':
          ensure  => absent,
          name    => '/media/ephemeral1',
          device  => "/dev/${::ec2_block_device_mapping_ephemeral1}",
        }

        mount { 'data_dir_mount':
          ensure  => mounted,
          name    => $data_dir,
          device  => "/dev/${::ec2_block_device_mapping_ephemeral1}",
          atboot  => true,
          options => 'defaults,comment=puppet',
          fstype  => auto,
          dump    => 0,
          pass    => 2,
          require => [Mount['ephemeral_media']],
        }
      }
    }

Thanks

edit retag flag offensive close merge delete

Comments

Could you please post the relevant snippet of your manifest. Are you using an exec or a mount? More details pls.

far4d gravatar imagefar4d ( 2015-06-19 02:03:26 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-06-18 20:02:56 -0500

DX gravatar image

Are you using the onlyif parameter on the exec type reference? https://docs.puppetlabs.com/reference...

edit flag offensive delete link more

Comments

I am not using exec to mount, i am using puppet mount inbuilt function.

rgv gravatar imagergv ( 2015-06-22 10:29:14 -0500 )edit
0

answered 2015-06-20 12:20:22 -0500

ramindk gravatar image

The Puppet mount provider isn't sophisticated enough to solve this problem. I spent a few days on it last year and never came up with a solution that wasn't a pile of hacks.

I solved it by building AWS AMIs that do not mount any ephemeral storage. Seemed the simplest and cleanest way to go about it.

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: 2015-06-18 16:45:08 -0500

Seen: 479 times

Last updated: Jun 20 '15