# Scratch disk: FileNotFoundError when file exists

**URL:** <http://hpc-community.unige.ch/t/scratch-disk-filenotfounderror-when-file-exists/1724>\
**Category:** HPC Technical\
**Created:** [October 5, 2021, 2:20pm UTC](http://hpc-community.unige.ch/t/scratch-disk-filenotfounderror-when-file-exists/1724 "2021-10-05T14:20:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stephanie.Bron](http://hpc-community.unige.ch/letter_avatar_proxy/v4/letter/s/67e7ee/32.png) [@Stephanie.Bron](http://hpc-community.unige.ch/u/Stephanie.Bron)\
**Post date:** [October 5, 2021, 2:20pm UTC](http://hpc-community.unige.ch/t/scratch-disk-filenotfounderror-when-file-exists/1724/1 "2021-10-05T14:20:58Z")

</div>

Hello, I’m reading and writing some files on the scratch disk and some of the jobs failed returning a FileNotFoundError when the file clearly exists at the correct location.

I tried to move my files to my home and I don’t seem to get this error anymore. Could it be related with the scratch disk being too full? I tried deleting some of my old files but it doesn’t solve the problem.

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![Stephanie.Bron](http://hpc-community.unige.ch/letter_avatar_proxy/v4/letter/s/67e7ee/32.png) [@Stephanie.Bron](http://hpc-community.unige.ch/u/Stephanie.Bron)\
**Post date:** [October 14, 2021, 8:07am UTC](http://hpc-community.unige.ch/t/scratch-disk-filenotfounderror-when-file-exists/1724/2 "2021-10-14T08:07:06Z")

</div>

So I realized that the problem of the files that were not found was a memory problem; I requested too little memory for my job. Below is an example of my submit script configuration:

```auto
#!/bin/env bash
#SBATCH --time=0-00:10:00
#SBATCH --partition=debug-cpu,private-dpnc-cpu,shared-cpu,public-cpu
#SBATCH --mem=60G
#SBATCH --output=log_txt/slurm-%J.out
#SBATCH --job-name='run_GRooTrackerVtx'

```

With this configuration, I have the problem that sometimes (seems random), files stored on the ${SCRATCH} disk are not found. This doesn’t happen if I run the exact same script but this time reading and writing files on the ${HOME} disk (instead of ${SCRATCH}). Does reading from/writing to ${SCRATCH} takes more resources than reading from/writing to ${HOME}?

In order to be able to keep reading/writing on ${SCRATCH}), my fix to this problem was to request more memory for my jobs. E.g.:

```auto
#!/bin/env bash
#SBATCH --time=0-00:10:00
#SBATCH --partition=debug-cpu,private-dpnc-cpu,shared-cpu,public-cpu
#SBATCH --mem=80G
#SBATCH --output=log_txt/slurm-%J.out
#SBATCH --job-name='run_GRooTrackerVtx'

```

This works but causes a new problem. The jobs are held longer in the queue for reason (BadConstraints). After a while, the jobs start but it takes much longer than usual. Is there a workaround or good practice in this case?

Thank you!

---

<div class="post-metadata">

**Author:** ![Yann.Sagon](http://hpc-community.unige.ch/user_avatar/hpc-community.unige.ch/yann.sagon/32/3_2.png) [@Yann.Sagon](http://hpc-community.unige.ch/u/Yann.Sagon)\
**Post date:** [October 18, 2021, 9:27am UTC](http://hpc-community.unige.ch/t/scratch-disk-filenotfounderror-when-file-exists/1724/3 "2021-10-18T09:27:55Z")

</div>

Hi @Stephanie.Bron,

> [@Stephanie.Bron](#):
>
> the problem of the files that were not found was a memory problem

Can you share a jobid that had the issue please?

On which cluster do you submit your jobs?

> [@Stephanie.Bron](#):
>
> Does reading from/writing to ${SCRATCH} takes more resources than reading from/writing to ${HOME}?

No.

Can we see the remaining of your sbatch script please?
