Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • Announcements

    • Lizzy Trickster

      Latest Stable OpenComputers Version   11/26/16

      The latest released version of OpenComputers is version 1.7 for MC 1.7.10, 1.8.9, 1.9.4, 1.10.2, 1.11.2 & 1.12.1. See more information here! Beta/Dev builds can be found at the Jenkins Build Server (ci.cil.li)
Tag365

ServerFS - Host a filesystem over the network.

Recommended Posts

Using this program, you can host an array filesystem over a network. Set up is as simple as installing an autorun.lua script on the computer or server that hosts the ServerFS filesystem, and installing a boot script on the clients that will access the ServerFS filesystem.

 

How it works:

The "Host", the computer or server hosting the ServerFS fileserver, runs an autorun script which will allocate all non-primary filesystem components to a single virtual "ServerFS" component. It then receives messages over the network and when a message is received relating to the ServerFS the Host will then respond to the sender with a message with data related to the method it was trying to call.

 

A "Client", a computer or server connecting to the ServerFS Host, has a boot script installed which runs at startup and sets up a virtual component which functions like a normal filesystem component. Calling one of the virtual component's methods will cause the Client to send messages to the Host computer and wait for the Host to respond. The boot script also automatically mounts the virtual filesystem component to the "srv" directory.

 

Requirements:

The component must have a type of "modem" or "tunnel" in the computer or server. Network cards and Wireless Network cards have a type of "modem", while Linked cards have a type of "tunnel". Therefore, you can use a Network card, Wireless Network card, or Linked card to connect to the Host computer. The other components required are the filesystems you want in the Host's RAID array.

You must also have at least one filesystem attached to the Host computer.

 

How to set up ServerFS:

The "Host", the computer or server hosting the ServerFS fileserver.

Step 1: Install a modem or tunnel component (a Network card or Linked card will work for this, as each card acts as a modem or tunnel component respectively) to the Host computer or server, then install any filesystem components you want in the array.

Step 2: Get the autorun.lua script on to the Host. If the Host has an internet component installed execute "pastebin get cg1ieKUi /autorun.lua" and the required autorun script will be downloaded, or if you are the server host get the script at http://www.pastebin.com/raw/cg1ieKUi and add the script to the root of the filesystem that hosts the operating system.

Step 3: Run the autorun.lua script. The autorun script will allocate all non-primary filesystem components to a virtual filesystem array, and then will host the ServerFS functionality.

 

The "Clients", or computers connecting to the ServerFS fileserver served by the Host.

Step 1: Install a modem or tunnel component to the Client (a Network card, Wireless network card, or Linked card will work), then connect the Client to the Host. Do not connect it to the Host directly if a large amount of components are inserted to the Host, as this can cause the Client to stop and show a "Too many components connected" error.

Step 2: Install the boot script to the Client's boot filesystem. If the Client has an internet component installed execute "pastebin get HAgcbg41 /boot/98_serverfilesystem.lua", or if you are the server host get the script at http://www.pastebin.com/raw/HAgcbg41 and add the script to the path of "/boot/98_serverfilesystem.lua" on the filesystem that hosts the operating system.

Step 3: Reboot the computer. On startup a "srv" directory will be mounted.

Additional Information:

Please note that accessing functions of the server filesystem is noticeably slower than accessing the other filesystems on your network because the Host has to receive the request of the client from the network (which adds a delay that can be reduced by adding a CPU or APU to the relay if there is any), then process the request, and then send the processed information to the client. Don't expect it to be as fast as accessing functions of a filesystem attached to your computer.

If the network has relays connected, if too many requests are sent at in to short a timespan this can cause requests to be dropped by the relay and cause problems.

You should shut down the Host computer before adding or removing filesystems from or to the Host computer, as not doing so can cause issues where the server will attempt to access filesystems that are not attached to the computer.

For anyone that says that the files you create from the client are blank, this issue is caused by a change of the filesystem handling in an update to the OpenComputer mod, where file handles are not numbers anymore. I already made an updated version which is compatible with the updated handling of file handles and fixes the error by using numbers for file handle identification. The updated version to fix the issue has now been published. Update the script on the Host, then test to see if that fixed your issue. If not then report the issue you are having (post the issue again and that you updated the script if the same issue occurs).

Download:

The hosting autorun.lua script is at http://www.pastebin.com/cg1ieKUi

The 98_serverfilesystem.lua script to add in the boot directory of your clients is at http://pastebin.com/HAgcbg41

Edited by Tag365
Fixed path for the install command

Share this post


Link to post
Share on other sites

Seems cool, will try it out this weekend. Try to add more information though, such as if any specific actions are needed, such as mounting hard drives. Also is it kinda like a remote host, where you can sort of control what is done, or is it like a RAID where you can store and access data?

Share this post


Link to post
Share on other sites

This is a remote RAID where you can store and access data from across the network. Filesystems will be detected by the autorun script and included in the array. You can read and write to the filesystem remotely.

Share this post


Link to post
Share on other sites

The component must have a type of "modem" or "tunnel" in the computer or server. Network cards and Wireless Network cards have a type of "modem", while Linked cards have a type of "tunnel". Therefore, you can use a Network card, Wireless Network card, or Linked card to connect to the Host computer. The other components required are the filesystems you want in the Host's RAID array.

Share this post


Link to post
Share on other sites

Seems like this is broken in OC 1.6 dev builds pending a fix from Sugoi/Payonel with process cache being weak keyed. Looking forward to using this, though.

Share this post


Link to post
Share on other sites

In order for me to fix it, you need to tell me what is the error message, or if it does not throw an error, what is happening. Also, you need to give me information on how to get version 1.6 of OpenComputers.

Share this post


Link to post
Share on other sites

It is not designed to handle multiple Hosts being online and on the same network. I have not tested it yet, so it may or may not work correctly.

Share this post


Link to post
Share on other sites

As I said it is not designed to handle multiple Hosts running, as it doesn't favor any Host on the network, the first to respond is the one that is used.

Share this post


Link to post
Share on other sites

Every time I write a file to the host i have to reset it before any computer on the network can see it in the srv directory, including the pc that wrote it.

Evewn when I get it to show up when I ls, if i open (edit) it, the file is always blank.

Then if i save the file (test.txt), when i open and ls the srv directory on another pc, it will show test.txt and test.txt~, both being empty.
What am I doing wrong?

Share this post


Link to post
Share on other sites

PLEASE put a image/video tutorial! When my client computer access the srv folder, there is nothing and on the server computer I installed a program.

Share this post


Link to post
Share on other sites

Hey, awesome work here! But I cannot get it to work using linked cards. Also, when creating a new file, the file is saved in the server, but not its contents, i.e when I edit it, it returns a blank page.

Share this post


Link to post
Share on other sites

I also cannot get this entirely to work; while the system boots properly and I can create folders / list their contents, the moment I try to work with any files, it falls over.  doing something like `cd /srv` and `edit testfile` will seem to work, but the moment I try to save in edit, it throws an error:

bad argument #1 (string expected, got nil):
stack traceback:
[C]: in function 'error'
machine:631: in function <machine:628>
(...tail calls...)
/bin/edit.lua:117: in upvalue 'setSsatus'
/bin/edit.lua:527: in local 'handler'
/bin/edit.lua:583: in local 'onKeyDown'
...

On the server's side, I have attached its output log

After that, I attempted to run the command `echo "test" >> test`, and got another error.  I have attached that as well

slog.png

clog2.png

Share this post


Link to post
Share on other sites

Ok i fixed the SERVER SIDE issues, the client program is saying Failed to mount server file already exists, i'l work on fixing it next. not sure if we can put up fixed code, the original maker has been gone for a long while now.

 

EDIT: Client side seems to work just fine, but it wont connect with the server.

Share this post


Link to post
Share on other sites
On ‎2‎/‎4‎/‎2017 at 0:41 PM, Sukasa said:

I also cannot get this entirely to work; while the system boots properly and I can create folders / list their contents, the moment I try to work with any files, it falls over.  doing something like `cd /srv` and `edit testfile` will seem to work, but the moment I try to save in edit, it throws an error:

bad argument #1 (string expected, got nil):
stack traceback:
[C]: in function 'error'
machine:631: in function <machine:628>
(...tail calls...)
/bin/edit.lua:117: in upvalue 'setSsatus'
/bin/edit.lua:527: in local 'handler'
/bin/edit.lua:583: in local 'onKeyDown'
...

On the server's side, I have attached its output log

After that, I attempted to run the command `echo "test" >> test`, and got another error.  I have attached that as well

slog.png

clog2.png

This is caused by a change of the filesystem handling in an update to the OpenComputer mod, where file handles are not numbers anymore. I already made an updated version which is compatible with the updated file handles and fixes the problem by using numbers for file handle identification. However I have not published the updated version yet and I still have the files on my old computer. So wait for the updated version to be published.

The updated version to fix the issue has now been published. Test the updated version now to see if that fixed your issue.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×