Network Drive on Internal Sata HDD?

Hello all, been a while.

I had a LaCie Network Space, Design by Neil Poulton 500Gb. The Ethernet module stopped working so took out the Hard Drive and installed it on my PC. Copied all my work to another Hard Drive deleted all partitions and moved it back on the Hard Drive I took out of the LaCie box.

Initially the intention was to have it shared on the local Network so other computers can see it, but then it hit me. Would it be possible to use a similar setup as the Network Space so that it would be accessed from the network or a remote location with the PC it is connected on basically only supply the Ethernet access and the power?

TIA.

On 01/20/2012 10:26 AM, k-a wrote:
>
> Hello all, been a while.
>
> I had a LaCie Network Space, Design by Neil Poulton 500Gb. The Ethernet
> module stopped working so took out the Hard Drive and installed it on my
> PC. Copied all my work to another Hard Drive deleted all partitions and
> moved it back on the Hard Drive I took out of the LaCie box.
>
> Initially the intention was to have it shared on the local Network so
> other computers can see it, but then it hit me. Would it be possible to
> use a similar setup as the Network Space so that it would be accessed
> from the network or a remote location with the PC it is connected on
> basically only supply the Ethernet access and the power?

Of course you can do that. Just export the file system with NFS (for Linux), and
SMB (for Windows). That is essentially what the LaCie was doing. It may even
have Linux as its OS. Make certain that the server box has sshd enabled so that
you can get remote access for maintenance operations.

You can, of course, achieve the same end point using your current setup by doing
the exports. This approach has the benefit of allowing the use of the computer
for general operations.

Thanks for the immediate response.
Problem is maybe you should pretend you talk to a rookie, in fact dont pretend hehe :shame:

Here is what I get form your post:
NFS Network File System, initially developed form Sun Microsystems for accessing data through network on hard drives as if they were local drives.
SMB Server Message Block or Common Internet File System (CIFS), also used by Samba for cross platform data access.
LaCie indeed was running on linux but all setup is gone since I deleted the all partitions on the hard drive, I guess I need to recreate the setup.

Here is what I am not sure I know what you mean:
Server box, I assume you mean the PC on which you installed teh HDD I took out of hte LaCIe, if so sshd should be enabled for remote users to be able to login to the hard drive?
Export the file system?
Export it on NFS and SMB at the same time?
Second approach sounds more like what I had in mind, allocating as fewer resources as possible on this task.

Apologies for the ignorance, it would be great help if you could suggest a step by step guide or if its too much trouble, then some links that could help me learn more and make it easier to approach the end point. Tbh I would prefer the guide:)

Thanks again.

On 01/20/2012 11:26 AM, k-a wrote:

> Thanks for the immediate response.
> Problem is maybe you should pretend you talk to a rookie, in fact dont
> pretend hehe :shame:
>
> Here is what I get form your post:
> NFS Network File System, initially developed form Sun Microsystems for
> accessing data through network on hard drives as if they were local
> drives.
> SMB Server Message Block or Common Internet File System (CIFS), also
> used by Samba for cross platform data access.
> LaCie indeed was running on linux but all setup is gone since I deleted
> the all partitions on the hard drive, I guess I need to recreate the
> setup.
>
> Here is what I am not sure I know what you mean:
> Server box, I assume you mean the PC on which you installed teh HDD I
> took out of hte LaCIe, if so sshd should be enabled for remote users to
> be able to login to the hard drive?
> Export the file system?
> Export it on NFS and SMB at the same time?
> Second approach sounds more like what I had in mind, allocating as
> fewer resources as possible on this task.
>
> Apologies for the ignorance, it would be great help if you could
> suggest a step by step guide or if its too much trouble, then some links
> that could help me learn more and make it easier to approach the end
> point. Tbh I would prefer the guide:)

The LaCie is dead hardware. Forget it. BTW, The LaCie has a CPU, and Linux may
have been running on it, but it is now scrap.

Yes, the PC that now contains the hard drive is the server box. We use “box” to
mean any computer. You will not need sshd to access the hard drive. You will
need it to administer the computer that is supplying the exported file system.
Logging into the hard drive is mostly a Windows concept. With Linux, you have
complete control over disk access and can limit who gets access without ever
needing a log in.

A description of the process for manually setting up an NFS server is found at
http://nfs.sourceforge.net/nfs-howto/ar01s03.html. On openSUSE, you can use YaST
to do this. First, you will need to install the yast2-nfs-server package.
After you do that, you will need to restart YaST, go to Network Services. and
choose the NFS Server package. With the GUI start the NFS Server and select the
directory to export. Choosing options, hosts, etc. is left as an exercise.

You will then need to set up NFS clients on each computer that must access the
exported file system.

If you need to have Windows hosts, see http://opensuse.swerdna.org/index.html.

Thanks, for the explanatory info, I can take it from here about the NFS setup:)

Problem is that I need access available for Windows too, my bad didnt made it clear, so setting up Samba I suppose its the way to go. I have set up Samba before, so its not uncharted territory.

Would be simpler if I could set up a way of access with a web UI though. I would also like to be able to access from remote location through WAN. I know it can be done with samba but wondering if there is another way. Maybe OwnCloud with Mirall which looks pretty simple? Never messed with it though so dont know if it is what I am looking for.

Much appreciations for the patience:)

A few days gone by and I have managed to set up a NFS export that works pretty well, actually it fits the purpose and meets my needs completely. One thing I haven’t implemented yet is access to the export from WAN, but that was by far secondary. To reach there I went through some painful days of heavy reading, as I don’t like messing with things I don’t understand until I do completely and the usual procedure of trial and error.

I decided to make a new post describing the method used from start in an attempt to share the knowledge and give a helping hand to anyone that wants to achieve the same or something similar. Here is the step by step guide which I asked in a previous post and since it was not provided I decided to produce it my self. It is fairly detailed and explanatory to help all users, regardless of level of knowledge, to be able to achieve the end result.

The aim is to create a sharable network place that users can store and retrieve data and files. Access is granted for Windows and Linux users alike.

  1. Preparation of the location to be exported.

What is to be exported? Whether it is a folder, a hard drive or a partition on a hard drive it is good practice to define owner and group. The UID and GID of the owner comes in handy at a later point.
First run the “ls -l” command to list the directory you wish to share with permissions shown.
The output should look something like this:

drwxr-xr-x   3 root   root     4096 Jan 22 10:58 netdrive

First letter “d” means directory
Next three characters are the owners permissions, “r” for read, “w” for write and “x” for execute.
Next three characters are permissions for group, “-” means that write is not permitted for the group.
Next three characters are permissions for “others”, anyone that is not the owner and does not belong to the group specified.
Next number shows how many directories exist in that directory.
Next two words are the owner and group respectively, in this case both are “root”. Reason is that I am exporting a hard drive which I partitioned, formatted and mounted with “Partitioner” in Yast2 which requires you to be a root to use. If the hard drive was mounted as a user the owner of the directory would be the username and the group would be the primary group of the user.
Next is the size of the directory or the file, the date last modified and last is its name.

Since at some point you will need to give UID and GID to clients for accessing the export its better to be other than “root”.
Using the “chown” command in a terminal, change the ownership to your username.

chown username netdrive

“ls -l” should output

drwxr-xr-x   3 username   root     4096 Jan 22 10:58 netdrive

Now to change the group I had to do a little thinking. I am on a computer that multiple users access it using their own user accounts. Default group is “users” but if I wouldnt want all users to have access to the export I would need to create a group manually and add the users that I would want to have access to it. What came up at a later point is also the fact that a custom group would have to be created to all Linux computers, and add the users to that group as well. Instead I used one of the secondary groups available in Yast2. If there is no need for such strict security group “users” would suffice.

Yast->User and Group Management
Select a user and click “Edit”
Go to Details tab
In the window with the Additional Groups check the one you prefer.
Click “Ok”.
Repeat for all the users you wish to have access to read, write and execute in the exported directory.
Click “Ok” for the changes to apply.

Now in terminal use the “chgrp” command to change the group to “users” if suffice or the secondary group added to users with permissions to the export if you desire so.

chgrp “group” netdrive

“ls -l” should output

drwxr-xr-x   3 username   group     4096 Jan 22 10:58 netdrive

At this point users belong to the group can only read and execute as write is not permitted. In your set up it might be different, whichever the case if you desire to change permissions do so in terminal with the “chmod” command.

chmod [ugoa] +-=] [rwx] filename

First brackets are the references to the what you want to change permissions on. “u” is for user that is indicated as owner, “g” is for group of the owner, “o” is for other than the owner or the group owner belongs to and “a” is for all.
Second brackets is the operator that specifies how the permissions will change. “+” is used to add permissions, “-” is used to remove permissions and “=” is used to specify to what the permissions should change to.
In this example should you add “w” write mode for group the command is:

chmod g+w netdrive

So far the preparation for the export should be covered and everything is ready to setup the NFS server and client.

  1. Seting up NFS server.

There are a couple of ways to set up a NFS server. OpenSUSE with Yast makes it very easy but since there are some tweaking needed it tends to be a longer than just simple procedure so bear with me.

First you will need the nfs-client, nfs-kernel-server, yast2-nfs-client and yast2-nfs-server packages, so make sure they are installed.
Go to Yast->Software Management
Type “nfs” on the search field and click “search”. Check the packages mentioned above to install if they are not installed.
Click “Accept” to install them.

Go to Yast->Network Services and click on the “NFS Server” icon.
Under “NFS Server” click on the “Start” radio button. That starts the service and enables it to run always on system start up.
Under Firewall check the “Open Port in Firewall” to automatically set up the firewall to allow the other users on the network to see the export.
Under “Enable NFSv4” check “Enable NFSv4” and type a domain name such as “nfsServer”
Enabling GSS security casued problems for me so I left it unchecked.
Click “Next”.

On “Directories to Export” list, which should be empty if you setting up the NFSserver for the first time, appear all the directories that are exported.
To add a directory click on the “Add Directory” button. Browse to select the directory to be exported, select it and click on “Choose” button.
Click “Ok”

Another window opens with two fields, “Host Wild Card” and “Options”.

In “Host Wild Cards” you can either enter the dns domain of the computer or computers that will access the export or enter its or their IP address. Since apparently wild card characters tend not to work too well I would advice to use the IP address. However by default the Host Wild Card value is “*” which means that anyone can access the export. If there are multiple computers form which the exports will be accessed there might be a need to add different entries in the Hosts list. Another option is to add one entry with a range of IP addresses such as: 192.168.1.2\24.

On the “Options” field appear the options that will apply for accessing the exports by default.
In the following link under “General Options” there are all the available options for exports with the default values and their alternatives. It is recommended to read them carefully if you wish to have a good understanding and then decide what fits your needs.
exports(5): NFS server export table - Linux man page
My own setup is: Options: fsid=0,crossmnt,rw,no_root_squash,sync,no_subtree_check
When you are done click “Finnish”.

Now Yast have updated the /etc/exports file according to the input you gave when setting up the NFSserver. In my first attempt I encountered a problem where the changes were not applied correctly, so I advice to open that file and double check that everything is as they should be. You can always make changes and save that file instead of running the NFSserver from Yast but Yast still is simpler.

One more security step before you are done with setting up the NFSserver.
There are two files that the server checks when it is getting a request form a computer on the network.
First checks the /etc/hosts.allow file. That file contains a list of daemons or services and the IP addresses that are allowed to have access on them. From the research I have done those services are almost always portmap, lockd, rquotad, mountd and statd.
The way to input them in the /etc/hosts.allow file is:

portmap: 192.168.1.2 , 192.168.1.3 
lockd: 192.168.1.2 , 192.168.1.3
rquotad: 192.168.1.2 , 192.168.1.3
mountd: 192.168.1.2 , 192.168.1.3
statd: 192.168.1.2 , 192.168.1.3

Note that these IP addresses should be the same as the ones defined in the “Host Wild Card” field when you were setting up the NFSserver and the directories to be exported in Yast.
If the NFSserver dont find the IP of the computer that is sending the request in the /etc/hosts.allow file, it then checks the /etc/hosts.deny file. If no entry is found on either of these files then the client is allowed access. So its essential to make sure that all IPs are denied access in this case.
So the contents of /etc/hosts.deny should be:

portmap: ALL
lockd: ALL
rquotad: ALL
mountd: ALL
statd: ALL

At this point the NFSserver should be up and running.
A way to double check is to go to
Yast->System Services (Runlevel)
Click on the “Expert Mode” radio button
Scroll down to check if services “nfs” and “nfsserver” are running. If no try to start them manually and enable them form the “Set/Reset” button at the right bottom and click “Ok”.
If that wont work as it happened to me at some point, I have no solution. What I did was to solve that, as well as some other issues I had, was to reinstall openSUSE.

Another way to check, is to type “rpcinfo” in terminal. The output will list a number of services that are provided by portmapper, their versions and their availability over TCP or UDP ports.
Those services are the following with their respective file that are defined in the /etc/host.allow and /etc/host.deny files.
portmapper (portmap), nlockmgr (lockd), mountd (mountd), status (statd).

For further reading and understanding refer to the following link which was also provided by lwfinger
3.

  1. Seting up the Client in openSUSE.

You will repeat this procedure for all the computers you wish to have access to the exports.
First thing to do here is disablethe SUSEfirewall2. This is only temporalily because upon setting up the client you are provided with an option to open firewall for the client, but you cant detect the exports if firewall is on.
Go to Yast->Security and Users
Click on Firewall.
Click on “Stop Firewall Now”.
Click “Next”.
Click “Finish”.
If by any chance you still get the Firewall notification error just manually input the fields required.

Got to Yast->Network Services
Click on “NFS Client”.
On the “NFS Shares” tab, click on “Add”.

In the new window that appears under “NFS Server Hostname” click “Choose”.
Yast will scan the LAN for NFS servers running. Most likely in the results list there will be two entries. One is an IP address and the other in hex form. Since personally I prefer working with IP adresses, and have been so far I would go for the IP address. Both results however should point to the same NFSserver.
Under “Remote Directory” click on “Select” button.
The list should consist with the export you defined while settingup the server, in my case its “/”, that is because in the options when setting up the NFSserver I included “fsid=0” which means that all clients will see the “/netdrive” directory as “root directory”. Select it and then click “Ok”.
Click to check “NFSv4 Share”
Under “Mount Point (local)” type the location where the NFS export will be mounted, or browse to shoose a directory.
In my case its “/mnt/netdrive”
You can leave “Options” as “defaults” or change them according to your prefferences. Reffer to the links provided in the previous section.

On the “NFS Settings” tab check “Enable NFv4” and type a domain name under “NFSv4 Domain Name” such as “nfsServer”, preferably the same as was set when setting up the NFSserver.
Check “Open Port in Firewall”.
Click “OK”.

That should be it. In your file manager there should be a mount or a hard drive vissible named as the mount specified while setting up the NFSclient.

Remember to enable the firewall.

Reserved for Windows 7 Client Setup

No Edit feature? My bad.

  1. Setting up Windows 7 NFSclient

Here things become a little tricky. Windows 7 Ultimate and Enterprise have embeded NFS client, only its not installed by default. On Windows 7 Home and Professional the NFS client is absent and I am not sure if there is a way to get one, other than third party program options.

So the following methods work for Windows 7 Ultimate and Enterprise.

Common step: Enabling NFS client in Windows 7
Control Panel->Programs->Programs and Features->Turn Windows Features on or off.
In the window that opens, scroll down to find “Services for NFS”.
Expand and check both “Administrative Tools” and “Client for NFS” in the subtree.
Click “OK”.
Restart computer.

Common step: Mounting the export.
There are a few ways to do this.
Start->Computer.
On the top menu bar click on “Map network drive”
Onthe window that appears select the letter to be assigned on the network drive. Usually starts with “z:” and going backwards to “a:” through the alphabet. The first available is already selected.
On the “folder” field type the location of the export like this:

\\NFSserver\export

or

\\192.168.1.2
etdrive

Another way is with the “mount” command.
Start->click on the “Search programms and files” field
Type “cmd” and hit “Enter”
On command prompt type the mount command like:

mount \\NFSserver\export z:

or

mount \\192.168.1.2
etdrive z:

Either way should work but sometimes its more reliable and faster going with the “mount” command. Also there are more options to use, available at
Start->Control Panel->System and Security->Administrative Tools->Services fro Network File System (NFS)
In the new window select “Client for NFS” on the left and on the main window will appear subjects of the help files. Click to view “Mount NFS shares” for detailed documentation on the “mount” command.

If you right click on “Client for NFS” and go to properties you can adjust the way the mounts behave and define which protocol should be used. Messing around with these properties I found out that the biggest impact comes form the choice of Hard mounts. If it is selected and the server disconnects for whatever reason, the Windows system tend to stall until NFSserver responds. So as an advice I propose using soft mounts.

Now the export should be visible in the “Computer” window under “Network Location”. Problem is its not accessible, yet. Which leads us to the next step.

Next step solves the problem of the Windows and UNIX operating systems that use different mechanisms for user identification, authentication, and resource access control. My research produced three different methods. I have used only the first but I will mention all three because the other too although more complicated than what I need might meet you needs better than my own choice.

Accessing the export, approach 1.
Since I have only one computer running mainly Windows 7 Ultimate I chose the first approach, which is the faster and easier but I suppose it is not recommended for networks with many users.

Start->Computer->right click on the export->Properties
In the window appeared go to “NFS Attributes” and take note of the “Owner (UID)” and “Group (GID)” numbers.
Go to Start->click on the “Search programs and files” field.
Type “regedit” and hit enter.

On the left part of the window expand:
HKEY_LOCAL_MACHINE->SOFTWARE->Microsoft->ClientForNFS->CurrentVersion and click on “Default”.
On the right side of the window that appear the contents of the folder “Default”
Right click->New->DWORD (32-bit) Value
Name it “AnonymousUid” then right click on it and click “Modify…”
Under “Base” click on the “Decimal” radio button.
Under “Value data:” enter the “Owner (UID)” number noted earlier form the properties of the Network Drive.
Click “OK”

Once again
Right click->New->DWORD (32-bit) Value
Name it “AnonymousGid” this time, then right click on it and click “Modify…”
Under “Base” click on the “Decimal” radio button.
Under “Value data:” enter the “Group (GID)” number noted earlier form the properties of the Network Drive.
Click “OK”

Restart computer and the export now should be accessible.

Accessing the export, approach 2.
User Name Mapping.
In the following link there is extended information about the usage and how it works.
User Name Mapping and Services for UNIX NFS Support

Accessing the export, approach 3.
Using Active Directory.
Unfortunately I didnt manage to find a lot of information about this particular approach and tbh it is far from what would suit me. Nonetheless it is definitely a way to solve the problem.

I hope these information to be halpfull for you as it was for me.
Feel free to ask any questions and I will be happy, if I can, to provide the answers.
Also if anyone spots some mistakes or errors please feel free to let me know to correct them, my knowledge after all is limited on the issue and I would appreciate any additional information.