# Check if folder is mountPoint

**URL:** <https://discourse.nodered.org/t/check-if-folder-is-mountpoint/64788>\
**Category:** General\
**Created:** [7 July 2022 06:57 UTC](https://discourse.nodered.org/t/check-if-folder-is-mountpoint/64788 "2022-07-07T06:57:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![denissanga](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/denissanga/32/48346_2.png) [@denissanga](https://discourse.nodered.org/u/denissanga)\
**Post date:** [7 July 2022 06:57 UTC](https://discourse.nodered.org/t/check-if-folder-is-mountpoint/64788/1 "2022-07-07T06:57:54Z")

</div>

Hi all, I would like check if a folder is a mount point using a function in node-red. I try looking for fs or os function without success.  
Can someone help me?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [7 July 2022 07:04 UTC](https://discourse.nodered.org/t/check-if-folder-is-mountpoint/64788/2 "2022-07-07T07:04:15Z")

</div>

in newer versions of node-red you can add `fs` and `os` in the setup tab

![chrome_KSh4x3UgNy](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/9/d9ccde80125a9683f42c60dbcb708b25f6525deb.gif)

Note the rich help in the editor? This is achieved by setting the code editor to monaco (in `settings.js`)

---

<div class="post-metadata">

**Author:** ![denissanga](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/denissanga/32/48346_2.png) [@denissanga](https://discourse.nodered.org/u/denissanga)\
**Post date:** [7 July 2022 07:11 UTC](https://discourse.nodered.org/t/check-if-folder-is-mountpoint/64788/3 "2022-07-07T07:11:08Z")

</div>

many many thanks, Can I ask you if you know the correct function to check if folder is mount point in fs or os library?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [7 July 2022 07:23 UTC](https://discourse.nodered.org/t/check-if-folder-is-mountpoint/64788/4 "2022-07-07T07:23:38Z")

</div>

never tried.

try running `fs.realpath` and `fs.stat` against various paths and mount points - see if you can identify the difference?

Failing that, use the exec node to execute shell commands.

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [7 July 2022 07:56 UTC](https://discourse.nodered.org/t/check-if-folder-is-mountpoint/64788/5 "2022-07-07T07:56:26Z")

</div>

Earlier I solved the same type of need but in a slightly different way:

- I created the folder in the space on my RPi and then I put a file inside with the name "unmounted"

- in the volume folder that then was mounted I put a file with the name "mounted"

(If you are worried those files might be deleted by mistake, you can always change access rights for them)

When unmounting/mounting the volume I can see the file names change accordingly. In this way you can check if it is mounted or not, both visually and programmatically. Maybe the suggestions from @Steve-Mcl fits your needs better, however I have not tried those myself

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [5 September 2022 07:56 UTC](https://discourse.nodered.org/t/check-if-folder-is-mountpoint/64788/6 "2022-09-05T07:56:56Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
