Move docker /var/lib/docker folder on external drive

  • Instead of linking, i tried editing the daemon.json file with:


    {

    "data-root": "/srv/dev-disk-by-label-HC/DockerBasePath/docker",

    "storage-driver": "overlay2"

    }


    If i try: " docker info | grep 'Docker Root Dir' " the output is "Docker Root Dir: /srv/dev-disk-by-label-HC/DockerBasePath/docker "


    So the path is ok, so why i do not see anything into OMV Docker?


    Anyway i think that the link is backwards, it should be ln -s /var/lib/docker /new/path and not ln -s /new/path /var/lib/docker. Right?

  • Did you properly copy all the files and directories from /var/lib/docker to /srv/dev-disk-by-label-HC/DockerBasePath/docker ?


    If you didn't properly copy them, then docker won't see them.

    --
    Google is your friend and Bob's your uncle!


    OMV AMD64 5.x on ASRock Rack C2550D4I C0 Stepping - 16GB ECC - Silverstone DS380 + Silverstone DS380 DAS Box.

  • Did you properly copy all the files and directories from /var/lib/docker to /srv/dev-disk-by-label-HC/DockerBasePath/docker ?


    If you didn't properly copy them, then docker won't see them.

    I think so, did it several times. What command do you suggest? So i can try right now.


    Could be the difference of file systems? Microsd is btrfs and HD is ext4.


    EDIT: Yep, it was the different filesystem. Writing here so it can help someone else. You can't move docker base path on different filesystems.

  • I did originally ln -s /sharedfolders/AppData/data/docker /var/lib/docker but in fact it wont work this way docker has to be a symlink outside of a share folder I put it directly on the root of my disk

    the only problem I I am using OMV4 and do not know how to connect it with portainer to uprade to OMV5

  • I did originally ln -s /sharedfolders/AppData/data/docker /var/lib/docker but in fact it wont work this way docker has to be a symlink outside of a share folder I put it directly on the root of my disk

    the only problem I I am using OMV4 and do not know how to connect it with portainer to uprade to OMV5

    Maybe you should have used the complete absolute path of the disk/directory instead of the "sharedfolder"? For example /srv/dev-disk-by-label-etc.


    Anyway i do not know if the symlink works if the directories are on different filesystems, if this is your case.


    Only thing i can notice is that you used "/sharedfolders/AppData/data/docker" the image shows a second docker dir nested into the first docker dir. Maybe you have to fix that?

  • Maybe you should have used the complete absolute path of the disk/directory instead of the "sharedfolder"? For example /srv/dev-disk-by-label-etc.


    Anyway i do not know if the symlink works if the directories are on different filesystems, if this is your case.


    Only thing i can notice is that you used "/sharedfolders/AppData/data/docker" the image shows a second docker dir nested into the first docker dir. Maybe you have to fix that?

    I am aware of this i got an extra docker folder but the link goes to the right one so it is working.

  • Well on omv 4 I am not using portainer, see there my first test trying to upgrade to omv5 RE: Reconnecting with my existing docker data and portainer not working


    - like I said I got an extra top docker folder not sure how to delete it without loosing the real nested bottom folder docker! so since it is woking like this for a long time I never took care of this!


    ls -asl /var/lib/docker

    0 lrwxrwxrwx 1 root root 39 Nov 2 11:50 /var/lib/docker -> /srv/dev-disk-by-label-WD_10TB_1/docker

  • You are right it supposed to be dev-disk-by-label-WD_10TB_1/docker/docker but I changed before posting for simplification and I forgot about it yes it always worked as


    root@rockpro64:~# ls -asl /var/lib/docker

    0 lrwxrwxrwx 1 root root 46 Mar 27 23:16 /var/lib/docker -> /srv/dev-disk-by-label-WD_10TB_1/docker/docker

    root@rockpro64:~#


    I did not noticed since my Appdata are still in a share folder so I had to try to play a movie to realize the issue

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!