Use Windows share to store fog image with cifs on Ubuntu

  • Reason:

    For the people that do not want to setup NFS server on windows but want to use windows share to store fog images.

    Windows share that use CIFS/SMB mount will only work with user space NFS server such as unfsd3 or NFS-Ganesha

    The regular kernel mode nfs_kernel_server does not compiled to support NFS re-export.

    Assume you have a windows server with a share folder call fogshare and the share user is fog with the password fog. The FOG sever is on Ubuntu server.

    sudo -i
    #install CIFS support
    apt-get install cifs-utils

    #Backup images folder so you can copy .mntcheck file later
    mv /images /images.old
    mkdir images
    chmod -R 777

    #edit /etc/fstab to add the following line so windows share folder will mount to /images
    //windows server IP or name/fogshare /images cifs username=fog, password=fog,noserverinfo,iocharset=utf8,file_mode=0777,dir_mode=0777,sec=ntlmssp 0 0

    #backup /etc/exports
    cp exports exports_nfs_kernal_server

    #remove nfs_kernal_server
    apt-get remove nfs-kernal-server

    #add the unfsd3 server source to /etc/apt/sources.list
    #add archive lucid apt source for unfsd3
    deb lucid main restricted universe
    deb-src lucid main restricted universe

    #install unfs3
    apt-get update
    apt-get install unfs3

    #unfs3 does not like a * in the /etc/exports
    replace the * with internal network x.x.x.x/24

    /images x.x.x.x/24(ro,sync,no_wdelay,no_subtree_check,insecure_locks,no_root_squash,insecure,fsid=0)
    /images/dev x.x.x.x/24(rw,async,no_wdelay,no_subtree_check,no_root_squash,insecure,fsid=1)

    #backup exports for future use
    cp /etc/exports /etc/exports_ufs3

    #copy /image.old files to the new /images

    #restart unfs3
    /etc/init.d/unfs3 restart

    This works on Ubuntu 14.04 and should work with other version as well.

  • I’m going to try this.