# How to avoid "resource cloning" warning while using mount on the same directory

**URL:** <https://discourse.chef.io/t/how-to-avoid-resource-cloning-warning-while-using-mount-on-the-same-directory/15418>\
**Category:** Chef Infra (archive)\
**Created:** [June 20, 2019, 8:12am UTC](https://discourse.chef.io/t/how-to-avoid-resource-cloning-warning-while-using-mount-on-the-same-directory/15418 "2019-06-20T08:12:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kontooo2X](https://avatars.discourse-cdn.com/v4/letter/k/eb9ed0/32.png) [@Kontooo2X](https://discourse.chef.io/u/Kontooo2X)\
**Post date:** [June 20, 2019, 8:12am UTC](https://discourse.chef.io/t/how-to-avoid-resource-cloning-warning-while-using-mount-on-the-same-directory/15418/1 "2019-06-20T08:12:32Z")

</div>

Hi. I know that when I use two resources that have the same name, I might get "deprecated feature used: resource cloning" warning. I could change the name of resources to avoid resource cloning and get rid of that warning. But what if I can not change resource name? Let's say I have mount at the beginning of my recipe:

```
mount '/mnt/directory' do
  device "//192.168.1.2/something"
  action [:mount]
end

```

and then at the end I have umount:

```
mount '/mnt/directory' do
  device "//192.168.1.2/something"
  action [:umount]
end

```

I know that this is not common to do both mount and umount in one recipe, but that's my unorthodox way of achieving something. While executing this recipe I get warning about "deprecated feature used: resource cloning". How can I avoid that warning while I can not change the name of second resource, since "/mnt/directory" is the name and I can not change the directory on which the umount will take action?

---

<div class="post-metadata">

**Author:** ![Kontooo2X](https://avatars.discourse-cdn.com/v4/letter/k/eb9ed0/32.png) [@Kontooo2X](https://discourse.chef.io/u/Kontooo2X)\
**Post date:** [June 20, 2019, 9:29am UTC](https://discourse.chef.io/t/how-to-avoid-resource-cloning-warning-while-using-mount-on-the-same-directory/15418/2 "2019-06-20T09:29:24Z")

</div>

I have to answer my own questions since someone helped me on StackOverflow. There is a way to do that, you just have to define "mount\_point" property and then you can change resource name while still defining what is the mount point:

```auto
mount 'mounting /mnt/directory' do
  mount_point '/mnt/directory'
  device "//192.168.1.2/something"
  action [:mount]
end

mount 'umounting /mnt/directory' do
  mount_point '/mnt/directory'
  device "//192.168.1.2/something"
  action [:umount]
end

```
