<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: File directory not synchronized - synfs after mssparkutils.fs.mount in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/File-directory-not-synchronized-synfs-after-mssparkutils-fs/m-p/4841736#M12704</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/120263"&gt;@dbeavon3&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You’re not imagining it - the /synfs path you get back from mssparkutils.fs.getMountPath(...) is an eventually-consistent projection of OneLake into the notebook’s file system. When you add or rename files &lt;STRONG&gt;outside&lt;/STRONG&gt; the running Spark session (e.g., via the Lakehouse UI, another job, or upload), it can take a while before the mount’s directory listing catches up. That’s why your open("/synfs/notebook/.../Partition.xml") failed for several minutes and then “magically” started working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Two workarounds:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;Refresh the mounts before you read&lt;/STRONG&gt;&lt;BR /&gt;&lt;PRE&gt;import mssparkutils
mssparkutils.fs.refreshMounts()&lt;/PRE&gt;This forces the workspace/job mount metadata to resync so new files show up faster. See: &lt;A href="https://learn.microsoft.com/en-us/fabric/data-engineering/microsoft-spark-utilities" target="_blank" rel="noopener"&gt;Microsoft Spark Utilities docs&lt;/A&gt; and the refreshMounts reference notes here: &lt;A href="https://learn.microsoft.com/en-us/azure/synapse-analytics/spark/synapse-file-mount-api" target="_blank" rel="noopener"&gt;Synapse mount API (same APIs)&lt;/A&gt;.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;(Better) Skip /synfs for reads and use an ABFSS path&lt;/STRONG&gt;&lt;BR /&gt;Read the file directly from OneLake instead of the mounted filesystem. With Python, use fsspec so you can call open() on ABFSS:&lt;PRE&gt;import fsspec

abfss_path = "abfss://&amp;lt;workspaceId&amp;gt;@onelake.dfs.fabric.microsoft.com/&amp;lt;LakehouseName&amp;gt;/Files/InventoryManagement/InventoryAgings/Partition.xml"
with fsspec.open(abfss_path, "rb") as f:
    full_doc = f.read()&lt;/PRE&gt;This avoids the /synfs cache entirely. Nice walkthrough: &lt;A href="https://fabric.guru/using-fsspec-to-define-onelake-filesystem-in-fabric" target="_blank" rel="noopener"&gt;Using fsspec with OneLake&lt;/A&gt;.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Oct 2025 14:28:29 GMT</pubDate>
    <dc:creator>tayloramy</dc:creator>
    <dc:date>2025-10-03T14:28:29Z</dc:date>
    <item>
      <title>File directory not synchronized - synfs after mssparkutils.fs.mount</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/File-directory-not-synchronized-synfs-after-mssparkutils-fs/m-p/4841728#M12703</link>
      <description>&lt;P&gt;I had been struggling for about 10 minutes to read a file from the lakehouse.&lt;BR /&gt;&lt;BR /&gt;I mounted like so:&lt;/P&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;fspath&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;mssparkutils&lt;/SPAN&gt;&lt;SPAN&gt;.fs.mount(&lt;/SPAN&gt;&lt;SPAN&gt;my_files_path&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"/LakehouseFiles"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dbeavon3_0-1759500304030.png" style="width: 664px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1301421i93F17F16EBD27B1D/image-dimensions/664x276?v=v2" width="664" height="276" role="button" title="dbeavon3_0-1759500304030.png" alt="dbeavon3_0-1759500304030.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;... then I &lt;STRONG&gt;added new directories and a new file in to the lakehouse "Files".&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;The file was called "Partition.xml".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I tried to read the Partition.xml file (below) and it kept failing:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dbeavon3_1-1759500401402.png" style="width: 604px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1301422iAFB1F5012CA31C23/image-dimensions/604x163?v=v2" width="604" height="163" role="button" title="dbeavon3_1-1759500401402.png" alt="dbeavon3_1-1759500401402.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;FileNotFoundError: [Errno 2] No such file or directory: '/synfs/notebook/xxxxxxx-cf8e-45a8-9097-15f0db4f3883/LakehouseFiles/InventoryManagement/InventoryAgings/Partition.xml'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Finally after about ten minutes it worked.&amp;nbsp; What a nightmare.... Can someone tell me if this is expected behavior for the "synfs" mounts?&amp;nbsp; This crappy behavior sounds like the par for the course, based on my other experiences on this platform, but ten minutes is way too long.&amp;nbsp; Is there anyway to force the mssparkutils.fs mounts to behave better?&amp;nbsp; Eg. should I synch on demand?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 03 Oct 2025 14:10:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/File-directory-not-synchronized-synfs-after-mssparkutils-fs/m-p/4841728#M12703</guid>
      <dc:creator>dbeavon3</dc:creator>
      <dc:date>2025-10-03T14:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: File directory not synchronized - synfs after mssparkutils.fs.mount</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/File-directory-not-synchronized-synfs-after-mssparkutils-fs/m-p/4841736#M12704</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/120263"&gt;@dbeavon3&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You’re not imagining it - the /synfs path you get back from mssparkutils.fs.getMountPath(...) is an eventually-consistent projection of OneLake into the notebook’s file system. When you add or rename files &lt;STRONG&gt;outside&lt;/STRONG&gt; the running Spark session (e.g., via the Lakehouse UI, another job, or upload), it can take a while before the mount’s directory listing catches up. That’s why your open("/synfs/notebook/.../Partition.xml") failed for several minutes and then “magically” started working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Two workarounds:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;Refresh the mounts before you read&lt;/STRONG&gt;&lt;BR /&gt;&lt;PRE&gt;import mssparkutils
mssparkutils.fs.refreshMounts()&lt;/PRE&gt;This forces the workspace/job mount metadata to resync so new files show up faster. See: &lt;A href="https://learn.microsoft.com/en-us/fabric/data-engineering/microsoft-spark-utilities" target="_blank" rel="noopener"&gt;Microsoft Spark Utilities docs&lt;/A&gt; and the refreshMounts reference notes here: &lt;A href="https://learn.microsoft.com/en-us/azure/synapse-analytics/spark/synapse-file-mount-api" target="_blank" rel="noopener"&gt;Synapse mount API (same APIs)&lt;/A&gt;.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;(Better) Skip /synfs for reads and use an ABFSS path&lt;/STRONG&gt;&lt;BR /&gt;Read the file directly from OneLake instead of the mounted filesystem. With Python, use fsspec so you can call open() on ABFSS:&lt;PRE&gt;import fsspec

abfss_path = "abfss://&amp;lt;workspaceId&amp;gt;@onelake.dfs.fabric.microsoft.com/&amp;lt;LakehouseName&amp;gt;/Files/InventoryManagement/InventoryAgings/Partition.xml"
with fsspec.open(abfss_path, "rb") as f:
    full_doc = f.read()&lt;/PRE&gt;This avoids the /synfs cache entirely. Nice walkthrough: &lt;A href="https://fabric.guru/using-fsspec-to-define-onelake-filesystem-in-fabric" target="_blank" rel="noopener"&gt;Using fsspec with OneLake&lt;/A&gt;.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Oct 2025 14:28:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/File-directory-not-synchronized-synfs-after-mssparkutils-fs/m-p/4841736#M12704</guid>
      <dc:creator>tayloramy</dc:creator>
      <dc:date>2025-10-03T14:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: File directory not synchronized - synfs after mssparkutils.fs.mount</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/File-directory-not-synchronized-synfs-after-mssparkutils-fs/m-p/4841753#M12706</link>
      <description>&lt;P&gt;Thanks.&amp;nbsp; I wanted to use more conventional python libraries (os).&amp;nbsp; Sometimes that makes it easier for AI assistance, and for migrating solutions to other platforms as needed (or for simply copy/pasting sample pyspark scripts to other standard python solutions).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I like the tip about refreshMounts.&amp;nbsp; I will do that more frequently.&amp;nbsp; Only about 1% of my operations read directly from files.&amp;nbsp; Most of the file operations are for reading/writing blob data from abfss via pyspark.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Oct 2025 14:51:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/File-directory-not-synchronized-synfs-after-mssparkutils-fs/m-p/4841753#M12706</guid>
      <dc:creator>dbeavon3</dc:creator>
      <dc:date>2025-10-03T14:51:07Z</dc:date>
    </item>
  </channel>
</rss>

