.nfs0000... files keep showing up and disappearing when using Mercurial

7,614

.nfs* files are related to NFS. They appear on an NFS server when a file is deleted, but is still open by a client. The server must not delete the file because it still needs to provide the data to the clients that have it open. On the other hand, the server must delete the file because the process that deleted it expects it to no longer exist. So the NFS server renames the file to a name that hopefully nobody cares about.

It's no use to try deleting them: you'd be deleting a file that's still open by an NFS client, so the server would only create a new .nfs* file to keep the data.

Eventually the client will close the files and the .nfs* droppings will vanish.

You can instruct Mercurial to ignore those files. In the [ui] section of your ~/.hgrc, add the line ignore = ~/.hgignore.global, and create the file ~/.hgignore.global containing the line .nfs*.

Share:
7,614

Related videos on Youtube

Nick T
Author by

Nick T

All code snippets I post on Stack Exchange are public domain. Working at Telnyx providing telecom services that run on the cloud. Used to work on BIG biological DATAAAAA, and before that embedded systems with my electrical engineering know-how. In order of preference: Python C (on embedded mostly, no filesystems, no malloc.) JavaScript (need to learn TypeScript) Others: HTML, CSS, Java. I like stout, esp. oatmeal stout. Gin and tonic if we're talking mixed drinks. Also like Portal (hell, all Valve games), and would...if Gabe would release Half-Life 3 already. Any Animal Can Evolve to Fly!

Updated on September 18, 2022

Comments

  • Nick T
    Nick T almost 2 years

    As of late, something seems to have happened on my machine that is more annoying than anything else: every time I look in a directory for Mercurial changes it tells me about two .nfs#### files that then immediately vanish. #### seems to increment every time they flicker back.

    Is my computer going nuts? Is this Mercurial related? File system related (this is a network mounted drive)?

    $ hg st
    ? .nfs000000001b1d062600000a43
    ? .nfs000000001b1d085a00000a44
    $ ls -lhtrA
    total 1.7M
    drwxrwxr-x 5 nick    nick    4.0K Sep  2 14:34 media/
    drwxrwxr-x 6 nick    nick    4.0K Sep 19 17:07 venv/
    drwxrwxr-x 7 nick    nick    4.0K Sep 19 18:55 lab_web/
    drwxrwxr-x 8 nick    nick    4.0K Sep 19 20:15 templates/
    drwxrwxr-x 5 nick    nick    4.0K Sep 20 17:44 .hg/
    -rw-rw-r-- 1 nick    nick     252 Jul 23 17:21 manage.py
    -rw-rw-r-- 1 nick    nick     177 Sep 19 17:07 requirements.txt
    -rw-r--r-- 1 nick    nick    1.7M Sep 19 19:46 lab_sqlite3.db
    -rw-rw-r-- 1 nick    nick     141 Sep 19 20:26 debug_requirements.txt
    -rw-rw-r-- 1 nick    nick     274 Sep 20 17:44 .hgignore
    $ hg st
    ? .nfs000000001b1d062600000a47
    ? .nfs000000001b1d085a00000a48
    $ hg st
    ? .nfs000000001b1d062600000a49
    ? .nfs000000001b1d085a00000a4a