3

Scenario

  • DDEV project has been moved from /home/old-path/project-name to /home/new-path/project-name
  • executing ddev start in new location shows the following error

Unable to get project(s): stat /home/old-path/project-name: no such file or directory

Question

Which steps are required in order to "relocate" the directory and get DDEV up and running again?

Oliver Hader
  • 4,093
  • 1
  • 25
  • 47

6 Answers6

6

Please ddev stop --unlist <project> to stop (and forget) the project, then ddev start in the new directory.

This is also in the FAQ

rfay
  • 9,963
  • 1
  • 47
  • 89
  • Thanks for the quick response. `ddev rm -a` would also lead to working projects being removed, correct? Are there any implications on e.g. loosing data? – Oliver Hader Jan 09 '19 at 17:52
  • 1
    `ddev rm` does not lose any data (unless you do `ddev rm --remove-data`). I said to use `ddev rm -a` because it would make sure that every project was stopped, it's just easy shorthand. – rfay Jan 10 '19 at 04:12
1

Analysis

Since DDEV outlined the correct old path name, it also must be stored somewhere. I've analyzed directory ~/.ddev/project-name/, but could not find any pointer to the old path name there. It seems that this information is stored at some other place.

Docker Containers

Executing docker ps -a | grep project-name shows the following:

1f4eb31fc94e        drud/ddev-webserver:v1.3.0        "/start.sh"              2 months ago        Exited (0) 2 months ago                                                                                                ddev-project-name-web
052ecb7c3e1b        drud/phpmyadmin:v1.3.0            "/run.sh phpmyadmin"     2 months ago        Exited (0) 2 months ago                                                                                                ddev-project-name-dba
b9d71147a54f        drud/ddev-dbserver:v1.3.0         "/docker-entrypoint.…"   2 months ago        Exited (0) 2 months ago                                                                                                ddev-project-name-db

And executing docker inspect ddev-project-name-web | grep '/home/old-path/project-name' shows additional information:

"/home/old-path/project-name/.ddev:/mnt/ddev_config:ro",
"/home/old-path/project-name:/var/www/html:cached"
"Source": "/home/old-path/project-name/.ddev",
"Source": "/home/old-path/project-name",
"com.ddev.approot": "/home/old-path/project-name",

Bingo! The old path name is stored inside Docker containers. And since my (valuable) sources only are mounted to this Docker container, it seems to be safe to remove this container by executing docker rm ddev-project-name-web. Starting DDEV again in the new directory using ddev start now works again...

Summary

Given that the DDEV project is named project-name...

docker rm ddev-project-name-web
cd /home/new-path/project-name
ddev start
Oliver Hader
  • 4,093
  • 1
  • 25
  • 47
1

There is a file named global_config.yaml that resides in your user's home .ddev folder (on my windows machine it is C:\Users\username\.ddev).

Inside this file you will find the section project_info: that lists your projects and their paths. If you moved the project files you can enter the new path here.

If you moved the files to another disk you also have to go to docker Settings>Resources>File Sharing and make sure the new disk is enabled here and cab be bind mounted.

arx-e
  • 41
  • 4
0

Also use the ddev rm --unlist once you have used ddev rm . Not sure if it is a recent addition to the CLI

0

I had to do a "ddev stop --unlist projectname" and do a "ddev start". Can not say if i lose data because it was a sqlite.

Rogoit
  • 81
  • 7
  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/29923209) – Hein Sep 26 '21 at 15:11
  • This was the solution for my problem in context of this behaviour. And I think this could help other persons, too ;) – Rogoit Sep 30 '21 at 11:28
0

I had the same issue. My solution:

ddev stop --unlist <projectname>
ddev start

This worked for me.