Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

NodeBB

  1. Home
  2. Selfhosted
  3. Docker is renaming a mounted drive [Solved]

Docker is renaming a mounted drive [Solved]

Scheduled Pinned Locked Moved Selfhosted
selfhosted
12 Posts 8 Posters 6 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • gedaliyah@lemmy.worldG This user is from outside of this forum
    gedaliyah@lemmy.worldG This user is from outside of this forum
    [email protected]
    wrote last edited by [email protected]
    #1

    So I recently moved most of my docker storage to a second hard drive, called "storage." After a system restart, docker is creating a folder called "storage," forcing the physical drive to be renamed "storage1." How do I prevent this from happening?

    I am using Xubuntu.


    Edit: As suggested, it was indeed my system spinning up Docker before mounting the internal disk. The solution (should work on most Unix-like systems) was to manually add a line to /etc/fstab as follows:
    First get the UUID for the problem drive

    ~$ sudo blkid -s UUID
    

    The output will show your drives and the UUID of each. Then edit the following file:

    ~$ sudo mousepad /etc/fstab #{or use your choice of editor, i.e. nano}
    

    Add the following line:

    /dev/disk/by-uuid/{UUID number copied from blkid output} /destination/of/your/drive ext4 defaults 0 0
    

    Of course replace {UUID number copied from blkid output} and /destination/of/your/drive and set defaults & parameters as needed. These worked for me.

    Restart the system and the drive should be forced to mount before docker starts. This seems to be a known issue with certain docker setups.

    W S I B 4 Replies Last reply
    27
    • gedaliyah@lemmy.worldG [email protected]

      So I recently moved most of my docker storage to a second hard drive, called "storage." After a system restart, docker is creating a folder called "storage," forcing the physical drive to be renamed "storage1." How do I prevent this from happening?

      I am using Xubuntu.


      Edit: As suggested, it was indeed my system spinning up Docker before mounting the internal disk. The solution (should work on most Unix-like systems) was to manually add a line to /etc/fstab as follows:
      First get the UUID for the problem drive

      ~$ sudo blkid -s UUID
      

      The output will show your drives and the UUID of each. Then edit the following file:

      ~$ sudo mousepad /etc/fstab #{or use your choice of editor, i.e. nano}
      

      Add the following line:

      /dev/disk/by-uuid/{UUID number copied from blkid output} /destination/of/your/drive ext4 defaults 0 0
      

      Of course replace {UUID number copied from blkid output} and /destination/of/your/drive and set defaults & parameters as needed. These worked for me.

      Restart the system and the drive should be forced to mount before docker starts. This seems to be a known issue with certain docker setups.

      W This user is from outside of this forum
      W This user is from outside of this forum
      [email protected]
      wrote last edited by
      #2

      I'm not an expert, but I think we need more information.

      gedaliyah@lemmy.worldG 1 Reply Last reply
      14
      • gedaliyah@lemmy.worldG [email protected]

        So I recently moved most of my docker storage to a second hard drive, called "storage." After a system restart, docker is creating a folder called "storage," forcing the physical drive to be renamed "storage1." How do I prevent this from happening?

        I am using Xubuntu.


        Edit: As suggested, it was indeed my system spinning up Docker before mounting the internal disk. The solution (should work on most Unix-like systems) was to manually add a line to /etc/fstab as follows:
        First get the UUID for the problem drive

        ~$ sudo blkid -s UUID
        

        The output will show your drives and the UUID of each. Then edit the following file:

        ~$ sudo mousepad /etc/fstab #{or use your choice of editor, i.e. nano}
        

        Add the following line:

        /dev/disk/by-uuid/{UUID number copied from blkid output} /destination/of/your/drive ext4 defaults 0 0
        

        Of course replace {UUID number copied from blkid output} and /destination/of/your/drive and set defaults & parameters as needed. These worked for me.

        Restart the system and the drive should be forced to mount before docker starts. This seems to be a known issue with certain docker setups.

        S This user is from outside of this forum
        S This user is from outside of this forum
        [email protected]
        wrote last edited by
        #3

        It sounds to me like one (or more) of your containers is referencing something on your storage drive, but Docker is loading before your drive gets mounted. When Docker sees that the folder its trying to access doesn't exist, it creates it, blocking your drive from taking that name.

        To fix it, you would need to make sure your storage drive is mounted before Docker starts, how you do that is down to you and your particular setup though.

        F 1 Reply Last reply
        10
        • W [email protected]

          I'm not an expert, but I think we need more information.

          gedaliyah@lemmy.worldG This user is from outside of this forum
          gedaliyah@lemmy.worldG This user is from outside of this forum
          [email protected]
          wrote last edited by
          #4

          I'm even less of an expert lol. What information can I provide to help?

          T 1 Reply Last reply
          5
          • gedaliyah@lemmy.worldG [email protected]

            So I recently moved most of my docker storage to a second hard drive, called "storage." After a system restart, docker is creating a folder called "storage," forcing the physical drive to be renamed "storage1." How do I prevent this from happening?

            I am using Xubuntu.


            Edit: As suggested, it was indeed my system spinning up Docker before mounting the internal disk. The solution (should work on most Unix-like systems) was to manually add a line to /etc/fstab as follows:
            First get the UUID for the problem drive

            ~$ sudo blkid -s UUID
            

            The output will show your drives and the UUID of each. Then edit the following file:

            ~$ sudo mousepad /etc/fstab #{or use your choice of editor, i.e. nano}
            

            Add the following line:

            /dev/disk/by-uuid/{UUID number copied from blkid output} /destination/of/your/drive ext4 defaults 0 0
            

            Of course replace {UUID number copied from blkid output} and /destination/of/your/drive and set defaults & parameters as needed. These worked for me.

            Restart the system and the drive should be forced to mount before docker starts. This seems to be a known issue with certain docker setups.

            I This user is from outside of this forum
            I This user is from outside of this forum
            [email protected]
            wrote last edited by
            #5

            Is Docker starting up and one of the containers mounts a volume to a /storage folder on the host? That could explain it but I’m not super clear on all that’s going on in your system.

            Quick test: disable auto start on all your containers and restart and see if it recurs.

            gedaliyah@lemmy.worldG 1 Reply Last reply
            1
            • gedaliyah@lemmy.worldG [email protected]

              I'm even less of an expert lol. What information can I provide to help?

              T This user is from outside of this forum
              T This user is from outside of this forum
              [email protected]
              wrote last edited by
              #6

              The commands you used to start the docker containers, or the docker compose contents.
              That's what dictates how much "power" a docker container has

              1 Reply Last reply
              4
              • I [email protected]

                Is Docker starting up and one of the containers mounts a volume to a /storage folder on the host? That could explain it but I’m not super clear on all that’s going on in your system.

                Quick test: disable auto start on all your containers and restart and see if it recurs.

                gedaliyah@lemmy.worldG This user is from outside of this forum
                gedaliyah@lemmy.worldG This user is from outside of this forum
                [email protected]
                wrote last edited by
                #7

                I believe that's exactly what is happening. I just don't know how to fix it. I could edit the YML files and delete restart: unless-stopped but I want my containers to restart if something goes down unexpectedly

                I 1 Reply Last reply
                0
                • S [email protected]

                  It sounds to me like one (or more) of your containers is referencing something on your storage drive, but Docker is loading before your drive gets mounted. When Docker sees that the folder its trying to access doesn't exist, it creates it, blocking your drive from taking that name.

                  To fix it, you would need to make sure your storage drive is mounted before Docker starts, how you do that is down to you and your particular setup though.

                  F This user is from outside of this forum
                  F This user is from outside of this forum
                  [email protected]
                  wrote last edited by
                  #8

                  That's a good theory. This may be able to be investigated further with systemd-analyze plot > boot.svg

                  1 Reply Last reply
                  2
                  • gedaliyah@lemmy.worldG [email protected]

                    So I recently moved most of my docker storage to a second hard drive, called "storage." After a system restart, docker is creating a folder called "storage," forcing the physical drive to be renamed "storage1." How do I prevent this from happening?

                    I am using Xubuntu.


                    Edit: As suggested, it was indeed my system spinning up Docker before mounting the internal disk. The solution (should work on most Unix-like systems) was to manually add a line to /etc/fstab as follows:
                    First get the UUID for the problem drive

                    ~$ sudo blkid -s UUID
                    

                    The output will show your drives and the UUID of each. Then edit the following file:

                    ~$ sudo mousepad /etc/fstab #{or use your choice of editor, i.e. nano}
                    

                    Add the following line:

                    /dev/disk/by-uuid/{UUID number copied from blkid output} /destination/of/your/drive ext4 defaults 0 0
                    

                    Of course replace {UUID number copied from blkid output} and /destination/of/your/drive and set defaults & parameters as needed. These worked for me.

                    Restart the system and the drive should be forced to mount before docker starts. This seems to be a known issue with certain docker setups.

                    B This user is from outside of this forum
                    B This user is from outside of this forum
                    [email protected]
                    wrote last edited by [email protected]
                    #9

                    It looks like you're relying on media automounting to access the drive, but this is happening too late for Docker.

                    I would suggest creating the empty folder and explicitly adding the mount to /etc/fstab instead. This should mount early enough, and even if it doesn't it needs an empty folder for the mount point anyway.

                    Edit: Make sure you reference the partition by UUID, because the device name of USB devices sometimes change after a reboot.

                    scrubbles@poptalk.scrubbles.techS gedaliyah@lemmy.worldG 2 Replies Last reply
                    11
                    • gedaliyah@lemmy.worldG [email protected]

                      I believe that's exactly what is happening. I just don't know how to fix it. I could edit the YML files and delete restart: unless-stopped but I want my containers to restart if something goes down unexpectedly

                      I This user is from outside of this forum
                      I This user is from outside of this forum
                      [email protected]
                      wrote last edited by
                      #10

                      So is the issue that your extra drive mounts to /storage, but that happens after Docker has already started and taken over the directory, so the mount fails? Normally I’d expect it to happen in the other order. Is this a weird race condition?

                      This might be a good thing to run through with ChatGPT- there are probably ways to delay the Docker container start, but maybe there’s a more significant misconfiguration you can deal with.

                      1 Reply Last reply
                      1
                      • B [email protected]

                        It looks like you're relying on media automounting to access the drive, but this is happening too late for Docker.

                        I would suggest creating the empty folder and explicitly adding the mount to /etc/fstab instead. This should mount early enough, and even if it doesn't it needs an empty folder for the mount point anyway.

                        Edit: Make sure you reference the partition by UUID, because the device name of USB devices sometimes change after a reboot.

                        scrubbles@poptalk.scrubbles.techS This user is from outside of this forum
                        scrubbles@poptalk.scrubbles.techS This user is from outside of this forum
                        [email protected]
                        wrote last edited by
                        #11

                        Agreed. Needs to be a required mount in fstab. System won't even start then if the mount fails, docker always has access

                        1 Reply Last reply
                        3
                        • B [email protected]

                          It looks like you're relying on media automounting to access the drive, but this is happening too late for Docker.

                          I would suggest creating the empty folder and explicitly adding the mount to /etc/fstab instead. This should mount early enough, and even if it doesn't it needs an empty folder for the mount point anyway.

                          Edit: Make sure you reference the partition by UUID, because the device name of USB devices sometimes change after a reboot.

                          gedaliyah@lemmy.worldG This user is from outside of this forum
                          gedaliyah@lemmy.worldG This user is from outside of this forum
                          [email protected]
                          wrote last edited by
                          #12

                          Thanks - this was the solution. I've updated the post to reflect the solution I used.

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Login or register to search.
                          Powered by NodeBB Contributors
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups