This project implements a Network File System (NFS), also known as a Distributed File System. The NFS allows clients to interact with files stored across multiple storage servers through a central naming server. The major components of the system are:
- Clients: Systems or users requesting access to files within the NFS.
- Naming Server (NM): A central hub that orchestrates communication between clients and storage servers.
- Storage Servers (SS): Servers responsible for the physical storage and retrieval of files and folders.
- The IP and Port of the Naming Server are known to all storage servers.
- Only text files (e.g., .txt, .c, .cpp, .py) are stored.
- No folder should end with a dot (.*).
- All file and folder names are unique.
- No files or folders can be created inside the root folder (base folder).
- All files and folders are assumed to have permissions (0777).
- TCP is used for all connections.
- If an SS is disconnected, it still shows its files to clients but cannot be modified.
- If there are more than two storage servers, backups are created.
- Folders always end with '/' to differentiate between files and folders.
- All files displayed in the accessible paths are only for read, write, delete, and copy.
- Ports are assigned to NM and clients starting from 7001, incrementing by 1. If a port is busy, the next available port is assigned.
- Commands cannot have spaces in front.
- The data to be read or written should be less than the size of the data packet being sent.
- The NM manages the directory structure and maintains information about file locations.
- The NM provides timely feedback to clients upon task completion.
- The NM dynamically updates the list of accessible paths and backups.
This project uses a Makefile to manage the build and execution of the Naming Server, Storage Server, and Client. To run the project, use the following commands:
- Compile and Run the Naming Server:
make NS
- Compile and Run the Storage Server::
make SS
- Compile and Run the Client::
make client
files/
- cl.h: Handles function operations.
- lru.h: Implements the Least Recently Used (LRU) cache mechanism.
- misc.h: Contains hashtables for efficient searching.
- ss.h: Manages Storage Server handlers.
ns.c: The main implementation file for the Naming Server.
SS.c: The main implementation file for the Storage Server, handling file operations and communication with the Naming Server and clients.
client.c: The main implementation file for the Client, handling user commands and interactions with the Naming Server and Storage Servers.