Docker Community Forums

Share and learn in the Docker community.

Unable to mount an available disk and run traffic to it using IOMeter

Hello,
I have a Red Hat server running Docker, that is capable of discovering remote storage using Fiber Channel. I would like to run traffic to the remote storage using containers, by mounting the remote storage disks to different volumes from different containers and run a traffic generation tool. The issue I am facing is with the mounting of the disk to a volume in a container.

For the traffic generation part, I have created an ubuntu image that comes with IOMeter installed in it. The container also has a volume created for mounting and running traffic. The volume is named /dev/sdb in the container. I am stuck at the point, where I am not able to mount a remotely discovered disk and attach it to this volume. My red hat server has two disks discovered and attached to it over Fiber Channel, namely ‘/dev/sdb’ and ‘/dev/sdc’. I would like to mount the disk /dev/sdb to the volume /dev/sdb in the container. I was able to successfully create a volume called SB_LUN_DISK1 using the following command:
docker create volume SB_LUN_DISK1 --driver local --opt o=device=/dev/sdb

When I try to mount this newly created volume to the Container volume /dev/sdb, I get the following error:
docker: Error response from daemon: error while mounting volume ‘/var/lib/docker/volumes/SB_LUN_DISK1/_data’ : missing device in volume options.

The discovered remote disks as seen from my red hat server is given below:

Disk /dev/sdb: 16 MB, 16777216 bytes, 32768 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sdc: 16 MB, 16777216 bytes, 32768 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Was wondering how I could fix the mount issue? Would be great if anyone has experience with mounting disks to a container.

My docker version is the following:

[root@MPR_DKR_162130 ~]# docker version
Client:
Version: 1.13.0
API version: 1.25
Go version: go1.7.3
Git commit: 49bf474
Built: Tue Jan 17 09:55:28 2017
OS/Arch: linux/amd64

Server:
Version: 1.13.0
API version: 1.25 (minimum version 1.12)
Go version: go1.7.3
Git commit: 49bf474
Built: Tue Jan 17 09:55:28 2017
OS/Arch: linux/amd64
Experimental: false
[root@MPR_DKR_162130 ~]#

Here a few details of my server:

[root@MPR_DKR_162130 ~]# uname -a
Linux MPR_DKR_162130 3.10.0-327.el7.x86_64 #1 SMP Thu Oct 29 17:29:29 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux

[root@MPR_DKR_162130 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.2 (Maipo)

Finally here is how my mount for the container I created looks like:

“Mounts”: [
{
“Type”: “volume”,
“Name”: “be025e42618dfe67fdc7b11d0e19ec2de8cf22bba8424f7a0efddf1a035fd76e”,
“Source”: “/var/lib/docker/volumes/be025e42618dfe67fdc7b11d0e19ec2de8cf22bba8424f7a0efddf1a035fd76e/_data”,
“Destination”: “/localdata”,
“Driver”: “local”,
“Mode”: “”,
“RW”: true,
“Propagation”: “”
},
{
“Type”: “volume”,
“Name”: “SB_LUN_DISK1”,
“Source”: “/var/lib/docker/volumes/SB_LUN_DISK1/_data”,
“Destination”: “/dev/sdb”,
“Driver”: “local”,
“Mode”: “z”,
“RW”: true,
“Propagation”: “”
}
],

Appreciate any feedback and steps to fix the issue.

Thanks,
Kaushik Prakash

I think you might want to use docker run --device or bind mount in the device (-v /dev/sdb:/dev/sdb) directly (you might need to --cap-add some caps for this) instead of using a docker volume.

I guess based on https://docs.docker.com/engine/reference/commandline/volume_create/ it seems possible to do with docker volume, but you have o=device=/dev/sdb above… it should be device=/dev/sdb. You might need to specify mount type with e.g. --opt type=ext4 as well.

Hello Nathan,
Thanks for your reply. I found a workaround to my problem. Instead of mounting the LUN directly, as suggested by you, I formatted the attached LUN, and made it appear like an attached disk drive. The names given to the disks were SB_DISK1 and SB_DISK2. The two drives were mounted at the following locations:
/run/media/root/SB_DISK1
/run/media/root/SB_DISK2.

Now that they are mounted as a formatted disk, instead of a raw lun, I was able to attach it to a container in the following manner:

docker run -d --net host -v /run/media/root/SB_DISK1:/dev/sdb -ti ubuntu-iometer /bin/bash

This worked, and I was able to run the traffic to the remote disks.

If I were to follow your suggestion, would these be the right sequence of commands?
docker create volume SB_DISK1 --driver local --opt device=/dev/sdb --opt type=ext4
docker run -d --net host -v SB_DISK1:/dev/sdb -ti ubuntu-iometer /bin/bash

Thanks again for your time. I hope my solution helps other folks who would faced the same problem as I did.

Kaushik Prakash

Seems more or less right (haven’t tried “device volumes” myself) although you have -d and -ti both in the docker run command there, which is probably not what you want.