How do I use 2 disks for CoreOS?

I've got a bare metal server with 2x 480gb SSD disks. I will run a CI server with docker on CoreOS.

Do I have to add another small disk to hold CoreOS and mount the 2x SSDs as /var/lib/docker?


Solution 1:

To use additional disks with CoreOS you specify their use with a systemd mount unit. For example:

$ cat /etc/systemd/system/media-Bulk.mount 
[Unit]
Description=External disk used by Docker & Libvirt

[Mount]
What=/dev/disk/by-uuid/5ef7a435-e3e2-4a0c-8090-4263f3ee8853
Where=/media/Bulk
Type=auto
FsckPassNo=0
Options=rw,relatime,seclabel,users,group,exec,suid,nodev,nofail

This will take the disk identified by the UUID 5ef7a435-e3e2-4a0c-8090-4263f3ee8853 and mount it to the path /media/Bulk.

Similarly if I wanted to mount this path to /var/lib/docker I would change the name of the unit from media-Bulk.mount to var-lib-docker.mount.

This assumes that the device has already been partitioned and had a filesystem created on it. If it has not this can be done with a systemd service unit of Type=oneshot.