1

I'm several child directories deep and I enter cd .. and receive this error:

cd: ..: No such file or directory

I am confused- of course there is a parent directory, I'm in it! A little digging shows that my coworker renamed a grandparent directory out from under me and when I tried to move to my parent directory, I got the above error. I tried to reproduce this like so:

server|/n01/data/adf/temp/TEMPTEST/SUB1/SUB2> pwd
/n01/data/adf/temp/TEMPTEST/SUB1/SUB2
server|/n01/data/adf/temp/TEMPTEST/SUB1/SUB2> mv /n01/data/adf/temp/TEMPTEST /n01/data/adf/temp/NEWTEMPTEST
server|/n01/data/adf/temp/TEMPTEST/SUB1/SUB2> pwd
/n01/data/adf/temp/NEWTEMPTEST/SUB1/SUB2

And now I am lost and adrift, changing to the parent directory will give me the same error as before.

server|/n01/data/adf/temp/TEMPTEST/SUB1/SUB2> cd ..
server|/n01/data/adf/temp/NEWTEMPTEST/SUB1>

No error. I changed directories successfully. What happened? Why didn't this error like the first time?

  • @RubberStamp I was able to recreate the same behavior using one shell to create and enter the test directory and another shell to rename it. – MackM Nov 18 '17 at 0:13
  • I left out the very relevant information that the first error I saw was on a EMC Isilon mount, and my attempted recreation was on the server's local disk. – MackM Nov 18 '17 at 0:26
5

Renaming the parent directory will not cause such an error. However, deleting will, for instance:

# mkdir -p some/deep/path
# cd some/deep/path
# rm -r some/deep/path
# cd ..
error: No such file or directory

There is no "rename" command per se in Linux. You can "move" things around though. When moving within the same filesystem, this equates to a rename. However, when moving between filsystems, this is effectively a copy / delete operation, which could result in a similar situation as that shown above, for instance:

# mkdir -p /fs1/a/b
# cd /fs1/a/b
# mv /fs1/a /fs2/a
# cd ..
error: No such file or directory

when /fs1 and /fs2 are different filesystems (mount points in this case).

| improve this answer | |
  • The 'rename was done with mv in both cases, but the first case was on an EMC Isilon mount, and my attempt to recreate was on the server's local disk. I'm sorry I left it out before, that is clearly relevant. – MackM Nov 18 '17 at 0:16
1

Simply renaming the directory would have accomplished nothing, because the name is just a label (that's how you can have two files pointing at the same object using hard links).

The parent directory's content was probably moved into a new directory, and the old directory, now empty, destroyed. This needs to be done while you're in the immediate child directory, I think.

This also happens if you move the directory around between different mounted filesystems while (optionally) renaming it; it's not the rename, but the filesystem change that forces the original to be deleted.

| improve this answer | |
  • The 'rename was done with mv in both cases, but the first case was on an EMC Isilon mount, and my attempt to recreate was on the server's local disk. I'm sorry I left it out before, that is clearly relevant . – MackM Nov 18 '17 at 0:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.