Mounting Multiple disks

I fear I may be approaching this all wrong; looking for suggestions.

Our docker host is a VM with a very small root volume. It hosts a mysql instance that should store it’s data on another volume (that volume is on high speed storage).

For the life of me, I can’t figure out how to get the second disk (/dev/vdb1) to mount at boot AND be available to the mysql container – what seems to be happening is when I mount it manually to the /data directory is that the container isn’t seeing the mount on /data – probably because of the massively complex file system overlay structure (?)…

How can the second disk be mounted at startup and how should it be mounted such that the mysql container actually sees it?



This seems not to be a problem for rancheros 0.4.1. When I mount (manually) the disk onto a mount point on the OS, the container IS able to see it when I use -v (e.g. -v /data:/var/lib/mysql). When I do the same thing on my 0.3.3 box, the container is unable to see the mount. Clearly I need to move off 0.3.3 :slight_smile:

Now… the remaining question is how to mount this second volume at boot time. Do I need to create a to mount it (as in the example for mounting an NFS disk)? Is there a better way?

I found myself in a similar situation, needing to mount an external disk. I ended up adding this to my cloud-config:

- path: /opt/rancher/bin/
  permissions: "0755"
  owner: root
  content: |
    mkdir -p /opt/seconddisk
    mount -t xfs /dev/vdb1 /opt/seconddisk

(of course, change xfs to your filesystem and choose a better name for /opt/seconddisk)

Most importantly, it does seem this runs before any containers (--restart=always) from user-docker are started, so it’s perfectly fine to bind mount it to any container.


1 Like