Saturday, July 10, 2010

Redirecting a Samba share to another server

In this post I'll describe how to configure Samba to redirect a share to another server. A typical example when this might be useful is as follows. You have a share, say \\server\work that you need to migrate to new hardware, so that it becomes \\newserver\work. However, you don't want all your users to remember that the files are at a new location. You'd like your users to continue using the old address \\server\work and be transparently redirected to \\newserver\work. This is possible with MS DFS (distributed filesystem) support via msdfs proxy directive. It seems like a more obscure directive not very well documented and described, so I'll try to report my experience with it.

The first thing to do is to enable MS DFS in Samba on the global level by specifying:


host msdfs = true

in the [global] section of smb.conf.

Then in the section for your share, you remove the path directive and insert two MS DFS-related directives, msdfs root and msdfs proxy:


[work]
msdfs root = true
msdfs proxy = \newserver\work

Note a few things about this configuration:
  1. You MUST NOT have the path directive in the share definition
  2. The value of msdfs proxy directive is the new location of the share to redirect to; notice though, that's a single backslash in the beginning of the value, NOT the double backslash you could have expected!

That's all, now \\server\work transparently redirects to \\newserver\work. Clients may need to be rebooted to start working properly with the redirected share. In my experience, clients can't access the share right after the reconfiguration, but it starts working after some time (not sure how much time) or after the client reboots.

2 comments:

T-One said...

hi,

in what environment do you use this setup?

i'm not really sure how this msdfs proxy operate. it this a real transparent setup? should the samba server be a ad-domain member? i want to redirect a share from \\intranet\share to \\fileserver\share, the intranet is a samba 3.5.10 centos server and the fileserver a windows 2008 r2 fileserver in a windows 2008 domain.

all the clients connecting are AD-members and should be authenticated via the fileserver.

T-One said...

hi,

in what environment do you use this setup?

i'm not really sure how this msdfs proxy operate. it this a real transparent setup? should the samba server be a ad-domain member? i want to redirect a share from \\intranet\share to \\fileserver\share, the intranet is a samba 3.5.10 centos server and the fileserver a windows 2008 r2 fileserver in a windows 2008 domain.

all the clients connecting are AD-members and should be authenticated via the fileserver.