Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
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
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?

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.

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?

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

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.

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.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.