Community Blog Implementing SMB Services on Alibaba Cloud

Implementing SMB Services on Alibaba Cloud

In this blog post, we'll introduce what Server Message Block is and show you how you can implement it using Alibaba Cloud's Storage Gateway product.

By Afzaal Ahmad Zeeshan, Alibaba Cloud Community Blog author and Alibaba Cloud MVP.

SMB Protocol

Server Message Block (SMB) is an authenticated, production-ready and widely used network file sharing protocol originally by Microsoft, which is later improved and extended by many other vendors. Almost all versions of Windows operating system (exempting windows XP) and several versions of Unix and Linux, and several other operating systems support it. However, in Linux based environments, an interface called Samba wraps up the functionality of Core SBM protocol-and then makes it available for other services on the platform or machine to consume the services. The base functionality of the SMB protocol is to perform core actions on shared files and folders-the resources, that are made available to be accessed over a network and their related actions-such as creating, modifying, and deleting the shared resources on the network. Moreover, it is also used to share the access of printer and serial ports over the network. SMB is an application layer protocol that uses IPC (inter-process communication) as a data-communication endpoint for data transmission between server and client.

People often get confused between the functionality and use-cases of FTP (file transfer protocol) and SMB. Though FTP is also a file transfer protocol, it requires its users to copy the complete file from one machine to another, consuming enough local storage space before they start using it. Whereas, SMB client does not have such storage space requirements since it does not save the file locally. Also, changes added from one user would be visible to all the other users as well-there is a configuration for the synchronization delay that controls this.

Although FTP has its own uses and benefits, there are scenarios where SMB protocol really shines. FTP is about transferring data, not making it collaborative. SMB protocol-if you have read and understood the above paragraph above understand that is-on the other hand a collaborative protocol, that lets network users share the resources, whether they would be cache resources, storage disks, or other resources such as printers.

SMB Limitations

Now first let us rule out what SMB is not. Although there are several revised versions of SMB, it is not without its own limitations, which are;

  • There is no support available for the distributed file system. Furthermore, the scalability problem is also observed when there are multiple machines sharing or accessing the file concurrently-in which case you can consider using other Alibaba Cloud services such as OSS for data storage.
  • Retrieving high-level details is sometimes not possible or yields unexpected results.
  • Security level or encryption status cannot be known from the SMB client and history related to file version, or access rights cannot be maintained.

Nonetheless, these limitations in SMB base protocol can be overcome by any cloud vendor before they use the SBM core protocol for any of their data storage or communication services. Therefore, this article will demonstrate the cloud storage services offered in Cloud Storage Gateway by Alibaba Cloud with a focus on how SMB protocol is implemented and how it helps enterprises utilize data storage services on the cloud, on-premises, and hybrid.

Alibaba Cloud Storage Gateway

Alibaba Cloud's service, which can be deployed as a storage gateway either on-premises or on Alibaba cloud services, is called Cloud Storage Gateway. Alibaba Cloud Object Storage Service (OSS) is used for the cloud-based secure, reliable, and cost-efficient data storage medium at the backend of Cloud Gateway. To support an end-to-end mechanism for file sharing and block storage, Alibaba Cloud Gateway storage has implemented stable protocol which are tested at the industry-level, such as NFS (Network File System), SMB (Server Message Block) and iSCSI (Internet Small Computer System Interface). Storage Gateway supports local caching to achieve fast and frequent data accessibility.

By default, Alibaba Cloud has disabled the service on your subscription and you need to manually enable the service to use it, visit here for that.


This is a free activation, you will not be charged for it.


Once you are done with this, you can wait for a confirmation email that confirms the activation of the service for your subscription. Depending upon your role in the subscription, you might also be asked for an authorization in the RAM for this service product. Perform the action and your service will be ready to control the resources within the subscription.


Once everything is done, continue with the article and we will explore how you can create an SMB based file sharing service on Alibaba Cloud-we will also explore the caching options, as well as the performance tracking to keep ourselves ready for any peak hours.

Supported Types of Cloud Storage Gateway

There are two main types of cloud storage gateway; Block Gateway and File Gateway, to meet enterprise-level high compatibility and performance requirements and user expectations with fast local access on their own machines.

Block Gateway

Block Gateway creates space in OSS buckets and provides granular level block access through iSCSI protocol to ensure the best performance and speed in a small file and local premises for which iSCSI is designed for.

Block Gateway supports write-through mode; data is first sliced down and then gets synchronized with the Cloud storage. The write-through method demands the user to have stable and highspeed cloudification links such as leased links-there are a bunch of options available for a direct network connection from your on-premises environments to the Alibaba Cloud infrastructure.

Block Gateway also supports cache mode. Transitory disks are created to accelerate read/write operations and help the synchronization of data to cloud storage.

File gateway

File Gateway connects OSS storage buckets at the backend and maps its own object directory structure with the file system of Network Attached Storage (NAS). However, for easy reading and writing of all the OSS buckets, CGS implements SMB and NFS protocol.

File-based CGS client ensures higher bandwidth and lower latency during read/write operations. This is the type of gateway that we are interested in reviewing for our article in this case, later we will study other options available in Alibaba Cloud's Cloud Storage Gateway for other purposes.

On the service home page, you will be able to create new gateways, and you can provide the details for the type of a gateway that you want.


Over the course of next tabs, you will be asked to give a couple of names and selections, once done you can create the gateway to create the SMB protocol-based files in there. The network settings are the same as you have created before, for the resources that are made available on Alibaba Cloud you can use an internal VNET. The pricing model is also flexible, and you can have a monthly commitment, or you can pay-as-you-go!


Finally, review the product information and create the service. You can also go back and make any changes as necessary.


A gateway is needed to create other resources inside the infrastructure, and we will next create our SMB file shares.

Configuring SMB Services for File Gateway

As mentioned already, Cloud Storage Gateway implements SMB services to support File Gateway, and it requires a server and a client (this client can also be the web interface). Users will need to request access using SMB from Windows clients to get an instant gateway response. Note that before using SMB services, you also need to configure a shared file directory on your virtual machine where you intend to run an instance of a cloud storage gateway. Then you can set user permissions and define other settings as well. The ultimate benefit is that you can configure these settings and enable and disable SMB from the storage gateway console as well.

Creating the SMB file share requires that you first create a cache instance in your infrastructure, for that we have a cache tab in the product gallery, and we can create a cache in under 10 seconds.


You can change the size and the type of the cache that you create, and once done you can then just create the instance-for me it took around 25 seconds to provision a 100 GB cache. Beautiful, right? A cache instance is needed during the creation of the SMB file share, as that fields helps your infrastructure keep the performance to an optimized level.

Head back to the Share tab and create a new share instance, and then add in the details for your OSS bucket-I am using one that I have been using in several of the articles that I have posted here.


After this, on the next tab configure a bit more about the SMB share, such as the SMB protocol, cache instance (that we just created) etc.


Under the advanced tab you can further configure how the deployment takes place. Not just the deployment, but also how the service uses the user queries.


After this, your SMB share would be created-in a few minutes of course-and you can connect that share to your own virtual machines and other clients that can connect to the SMB share.


You might want to connect to the VNET that contains this service.

Alibaba Cloud Gateway ¨C Features and Benefits

Currently, supported protocols for the network transmission are SMB and NFS to enable file accessing and sharing on the cloud. As NFS is used for the file system accessibility in Unix based operating systems such as AIX, HP-UX, and Linux, and SMB is for the Windows-based OS. Consider the following list of features:

  • The web-based configuration is supported, all the information regarding gateway stats such as CPU usage, memory usage, and bandwidth can be displayed on the dashboard.


  • Multiple OSS buckets can be added as per the requirements and configurations. Similarly, multiple cache disks can also be added.
  • You can create share points for SMB and NFS for Windows and Unix users, respectively.
  • AD (Active Directory) and LDAP (Lightweight Active Directory Protocol) are supported.
  • Log management and upgrade to higher versions of gateway comes as a default feature, as well.

Flexible, Fast and Scalable

CSG can be deployed on your local premises as well as on the ECS cloud data centers. There is no need of writing code; you can start using it right after its deployment with some easy and straight steps.

CSG provides you the option of using local storage for the fast and reliable data store along with the scalability of the cloud.

Multiple Protocol Support

You get a flexible range of file sharing protocols to suit your varying needs of operating system and file size.

Automatic Synchronization to Cloud

CGS supports both the write-through and caching modes, so you can cache data either locally to later synchronize it or keep writing it on cloud asynchronously on the go.

Multiple Deployment Methods

CGS offers deployment on different VMs using VMware such as VHD, Qcow2, and Raw VM images. It can also be deployed on ECS instances other than the standard operating systems; Windows and Unix.

Data Transmission and Validation

CGS implements multi-threading and asynchronous patterns to synchronize data on the cloud with proper consistency checks based on the MD5 algorithm.

End-to-end Logging and Monitoring

CGS monitors and logs all the activities in a well-organized way to track user activities.

I hope this blog post was informative and I encourage you to try out Cloud Storage Gateway today!

0 0 0
Share on


9 posts | 1 followers

You may also like