Skip to content

Instantly share code, notes, and snippets.

@rasheedamir
Forked from pantelis/coreos-windows-share.sh
Last active September 23, 2016 09:56
Show Gist options
  • Save rasheedamir/b9f4cae2e118b8c8935e45805935c169 to your computer and use it in GitHub Desktop.
Save rasheedamir/b9f4cae2e118b8c8935e45805935c169 to your computer and use it in GitHub Desktop.
Mount Windows share drives on CoreOS
# WARNING - THIS IN NOT a SHELL SCRIPT - JUST a LIST of COMMANDS
# based on https://github.com/coreos/coreos-overlay/issues/595 with links updated
# Build cifs-utils in a container and copy it into /tmp on the host.
$docker run -t -i -v /tmp:/host_tmp fedora /bin/bash
# On the container bash prompt
yum groupinstall -y "Development Tools" "Development Libraries"
yum install -y tar
yum install -y bzip2
curl https://download.samba.org/pub/linux-cifs/cifs-utils/cifs-utils-6.3.tar.bz2 | bunzip2 -c - | tar -xvf -
cd cifs-utils-6.3/
./configure && make
cp mount.cifs /host_tmp/
exit
#back at the host
$ sudo mkdir /mnt/foo
$ sudo /tmp/mount.cifs //198.51.100.23/foo /mnt/foo -o domain=zzz,username=xxx,password=yyy
$ mount | grep /mnt/foo
@rasheedamir
Copy link
Author

Workaround we came up with is to manually mount the fileshare in the cloud-init. So our cloud-init looks like this now:

- name: cifsmount.service
  command: start
  enable: false
  content: |
    [Unit]
    Description=Copy CIFS mount
    After=network.target

    [Service]
    Type=oneshot
    RemainAfterExit=yes
    TimeoutStartSec=0
    ExecStartPre = -/usr/bin/mkdir -p /opt/sbin
    ExecStart=/bin/sh -c "rm -fr /opt/sbin && rsync -a /usr/sbin/ /opt/sbin/ && /usr/bin/docker run -v /opt/sbin:/target so0k/mount.cifs_copy /target && mount --bind /opt/sbin/ /usr/sbin/ && mount -t cifs //<storage_account>.file.core.windows.net/<fileshare> /mnt/azure -o vers=2.1,username=<storage_account>,password=<storage_account_key>,dir_mode=0777,file_mode=0777"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment