{"id":6503,"date":"2017-02-27T09:04:53","date_gmt":"2017-02-27T01:04:53","guid":{"rendered":"http:\/\/rmohan.com\/?p=6503"},"modified":"2017-02-27T09:04:53","modified_gmt":"2017-02-27T01:04:53","slug":"deploy-a-distributed-file-system-server-on-centos-6","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6503","title":{"rendered":"Deploy a Distributed File System Server on CentOS 6"},"content":{"rendered":"<p>Distributed File Systems (DFS) are used to easily access multiple CIFS file shares, hosted on separate servers, using a single namespace on your network. The actual shares can either be hosted locally on the DFS server itself or on separate servers.<\/p>\n<p>The benefit of using a single namespace for your users to access your shares is they don\u2019t have to remember the names of each of your file servers; all shares can be accessed through one root name, regardless of where the actual file server resides. The access request will be redirected to the appropriate servers, all without the users\u2019 knowledge.<\/p>\n<p>Another benefit to using DFS, and it\u2019s a major one, is the ability to migrate shared data from one storage platform or server to another, transparently and quickly without your users ever knowing. You simply redirect a DFS hosted share to a new CIFS share, without ever having to change the share\u2019s name.<\/p>\n<p>With standard cifs file servers, you either need to send your users to a new share path after migration or suffer downtime while flipping between the new and old file server hardware, suffering a possible lengthy outage \u2013 depending on the complexity of your shares and their permissions.<\/p>\n<h2>Before you Begin<\/h2>\n<p>This lab will be based on the following configuration.<\/p>\n<ul>\n<li>One server running\u00a0<strong>CentOS 6.X<\/strong>.<\/li>\n<li>An Internet connection to access the the CentOS package repository.<\/li>\n<\/ul>\n<h2>Installing and Configuring Samba<\/h2>\n<ol>\n<li>Install Samba.\n<pre class=\"bash\">yum install samba<\/pre>\n<\/li>\n<li>Open Samba\u2019s configuration file into a text editor, like VIM or Gedit.\n<pre class=\"bash\">vi \/etc\/samba\/smb.conf<\/pre>\n<\/li>\n<li>Under the [global] settings, define the following options, modifying the highlighted values to match your environment.\n<div class=\"line\">[global]<\/div>\n<div class=\"line\">\u00a0<strong>workgroup = WORKGROUP<\/strong><\/div>\n<div class=\"line\">\u00a0<strong>netbios = MY-DFS-SERVER<\/strong><\/div>\n<div class=\"line\">\u00a0host msdfs = yes<\/div>\n<p>Understanding the options we are defining:<\/p>\n<table class=\"list\">\n<tbody>\n<tr>\n<th>workgroup<\/th>\n<td>The name of your Windows peer-to-peer network. Microsoft\u2019s default is WORKGROUP.<\/td>\n<\/tr>\n<tr>\n<th>netbios<\/th>\n<td>This is the single-label computer name used by a Windows on a network. Set this to the name you want your Samba server to have on the network.<\/td>\n<\/tr>\n<tr>\n<th>host msdfs<\/th>\n<td>The required parameter which tells Samba to act as a DFS host.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<\/ol>\n<h3>Set Samba Permissions for Selinux<\/h3>\n<p>Selinux on CentOS will block connections to Samba shares by default. We\u2019ll need to lift this restriction to allow users to access our DFS and to grant them read\/write permissions.<\/p>\n<ol>\n<li>Allow read and write permission to our samba shares:\n<pre class=\"bash\">setsebool samba_export_all_rw yes<\/pre>\n<\/li>\n<\/ol>\n<h3>Create the DFS Root Directory<\/h3>\n<p>The DFS root directory is where you create your DFS targets \u2013 links to other CIFS shares. Targets are created by creating symbolic links to your other cifs shares, using the msdfs protocol. The shares can exist on any server. To keep things simple for this lab, we\u2019ll create a cifs share on the DFS Root which we will create a target for.<\/p>\n<ol>\n<li>Create the directory that will host the CIFS targets:\n<pre class=\"bash\">mkdir -p \/export\/dfsroot<\/pre>\n<\/li>\n<li>Make sure the DFS root directory is owned by Root.\n<pre class=\"bash\">chown root:root \/export\/dfsroot<\/pre>\n<\/li>\n<li>Secure the DFS root to protect the DFS targets from changes by unauthorized users:\n<div class=\"line\">chmod 755 \/export\/dfsroot<\/div>\n<\/li>\n<\/ol>\n<h3>Create a Share to the DFS Root Directory<\/h3>\n<p>Next we\u2019ll need to share the DFS root directory to allow our users to access our DFS targets from a single name-space. To do this, we\u2019ll need to open up Samba\u2019s configuration file and add a new share.<\/p>\n<ol>\n<li>Open Samba\u2019s configuration file in text editor, like VIM:\n<pre class=\"bash\">vi \/etc\/samba\/smb.conf<\/pre>\n<\/li>\n<li>Near the bottom of the configuration file, create a Samba share to the DFS root by adding these lines to the bottom of the file, replacing the highlight lines to match your environment:\n<div class=\"line\">[dfs]<\/div>\n<div class=\"line\">\u00a0comment = DFS Root Share<\/div>\n<div class=\"line\">\u00a0<strong>path = \/export\/dfsroot<\/strong><\/div>\n<div class=\"line\">\u00a0browsable = yes<\/div>\n<div class=\"line\">\u00a0msdfs root = yes<\/div>\n<div class=\"line\">\u00a0read only = no<\/div>\n<\/li>\n<\/ol>\n<h3>Create a Share to be Used as a DFS Target<\/h3>\n<p>The DFS targets are the CIFS shares that a DFS root server will provide access to from a single name-space. These shares can be hosted on the local DFS root server or, ideally, on a separate server. To keep things simple, we\u2019ll create our first share on the DFS root server.<\/p>\n<ol>\n<li>Prepare a directory to be shared out\n<pre class=\"bash\">mkdir -p \/export\/samba\/finance<\/pre>\n<\/li>\n<li>Define the share by opening Samba\u2019s configuration file into a text editor, like VIM:\n<pre class=\"bash\">vi \/etc\/samba\/smb.conf<\/pre>\n<\/li>\n<li>Near the bottom of the file, configure you share so it looks similar to the following example:\n<div class=\"line\">[finance]<\/div>\n<div class=\"line\">\u00a0path = \/export\/samba\/finance<\/div>\n<div class=\"line\">\u00a0public = yes<\/div>\n<div class=\"line\">\u00a0writable = yes<\/div>\n<div class=\"line\">\u00a0browseable = yes<\/div>\n<\/li>\n<\/ol>\n<h2>Add DFS Targets<\/h2>\n<p>Finally, it\u2019s time to add some targets to our DFS server. The CIFS shares that we target can be on any host, Linux or Windows. To keep things simple in this tutorial, we\u2019ll create a share on the local DFS host that we\u2019ll use as a DFS target.<\/p>\n<ol>\n<li>Create a symbolic link to your DFS target.\n<pre class=\"bash\">link -s msdfs:my-dfs-server\\finance \/export\/dfsroot\/finance<\/pre>\n<div><strong>Warning:<\/strong>\u00a0The symbolic link file for the msdfs share\u00a0must\u00a0be lowercase. If it is not, you will get errors when trying to connect to the share.<\/div>\n<\/li>\n<li>Restart the Samba\u2019s daemon to apply our changes\n<pre class=\"bash\">service smb restart<\/pre>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Distributed File Systems (DFS) are used to easily access multiple CIFS file shares, hosted on separate servers, using a single namespace on your network. The actual shares can either be hosted locally on the DFS server itself or on separate servers.<\/p>\n<p>The benefit of using a single namespace for your users to access your shares [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6503"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6503"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6503\/revisions"}],"predecessor-version":[{"id":6504,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6503\/revisions\/6504"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6503"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6503"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6503"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}