CoreOS is a powerful Linux distribution built to make large, scalable deployments on varied infrastructure simple to manage. Based on a build of Chrome OS, CoreOS maintains a lightweight host system and uses Docker containers for all applications.
Mounting Portable Storage
All secondary mount files go in the /etc/systemd/system directory as the system level mounts are in a directory that is read-only in CoreOS. You will create a MOUNTPOINT.mount file. The Where section of the .mount file must match the filename. If the mount point is not directly off of / you have to name the file using the following syntax: path-to-mount.mount. As you can see in the following example we are wanting to mount the portable storage drive to /mnt/www so we name the file mnt-www.mount.
You have to use fdisk or parted to create the partition and make sure that the filesystem you create matches the one listed in the .mount file or else the service will fail to start.[Unit]
Description = Mount for Portable Storage[Mount]
What=/dev/xvdc1
Where=/mnt/www
Type=ext4[Install]
WantedBy = multi-user.target
CoreOS uses systemd so in order to make the mount point survive a reboot you must enable the *.mount file. If you use the '--now' flag the partition will be mounted immediately and set to start on boot.
$ systemctl enable --now mnt-www.mount
Mounting NFS/File Storage
The process for mounting our Endurance/Performance File Storage is pretty much the same, but since the mount is NFS we can specify some additional options using the Options= line in the mount file. In the following example we are setting the NFS to mount at /data/www.
$ cat data-www.mount
[Unit]
Description = Mount for Container Storage
[Mount]
What=nfsdal0501a.service.softlayer.com:/SL01SVxxxxxxxx_2
Where=/data/www
Type=nfs
Options=vers=4,sec=sys,noauto
[Install]
WantedBy = multi-user.target
We can now enable the mount and check that it is mounted properly.
systemctl enable --now /etc/systemd/system/data-www.mount cluster1 ~ # mount |grep data nfsdal0501a.service.softlayer.com:/SL01SXXXXXX_2 on /data/www type nfs4 (rw,relatime,vers=4.0,rsize=65536,wsize=65536,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=10.81.x.x,local_lock=none,addr=10.1.x.x)
Mounting NAS/Cifs
docker run -t -i -v /tmp:/host_tmp fedora /bin/bash
dnf groupinstall -y "Development Tools" "Development Libraries" dnf install -y tar dnf install -y bzip2 curl https://ftp.samba.org/pub/linux-cifs/cifs-utils/cifs-utils-6.4.tar.bz2 | bunzip2 -c - | tar -xvf - cd cifs-utils-6.4/ ./configure && make cp mount.cifs /host_tmp/
/tmp/mount.cifs //nasXXX.service.softlayer.com/USERNAME -o username=USERNAME,password=PASSWORD /path/to/mount
