This repository contains the implementation of a Network File System (NFS) as part of the CS3.301 Operating Systems course project at IIIT Hyderabad. The project demonstrates the design and development of a simplified NFS, focusing on key components and operations to simulate real-world networked file systems.
The Network File System (NFS) is a distributed system that allows multiple clients to access and manipulate files stored on remote servers. This project simulates the core components and functionalities of an NFS, enabling seamless interaction between clients, naming servers, and storage servers.
-
Clients
- Act as the interface for users or systems to interact with the NFS.
- Handle file-related operations such as reading, writing, deleting, and streaming.
-
Naming Server
- Serves as the central directory service, coordinating communication between clients and storage servers.
- Maps requested files or folders to the appropriate storage server, ensuring efficient access.
-
Storage Servers
- Manage physical storage and retrieval of files and folders.
- Handle data persistence, ensuring secure and efficient storage.
The following operations are implemented in the NFS:
-
Writing a File/Folder
- Supports both synchronous and asynchronous writes.
- Asynchronous writes optimize client response time for large files.
-
Reading a File
- Allows clients to retrieve file contents from the storage servers.
-
Deleting a File/Folder
- Enables efficient space management by removing unneeded files and folders.
-
Creating a File/Folder
- Supports the creation of new files and directories with proper metadata initialization.
-
Listing All Files and Folders in a Folder
- Provides directory navigation by listing all files and subfolders within a specified directory.
-
Getting Additional Information
- Retrieves metadata such as file size, access rights, and timestamps for files.
-
Streaming Audio Files
- Enables clients to stream audio files directly over the network.
-
Copy a File/Folder
- Enables clients to copy any file/folder within the directory.
-
Backing Up Files
- The files and folders stored by the client are backed up at multiple storage servers, so that in case one of the storage servers go down the data is preserved and accessible.
This implementation adheres to the following specifications provided during the course:
- Client Interaction: Clients serve as the primary interface for users to perform file operations.
- Centralized Naming Server: The naming server facilitates directory services by mapping requests to the appropriate storage server.
- Data Storage: Storage servers are responsible for the secure and efficient storage and retrieval of data.
- Operations: All supported operations are designed to simulate real-world NFS functionalities.
- A client writes a large file asynchronously to optimize response time.
- Users navigate directory structures and list contents using the client interface.
- Audio files are streamed directly from the NFS.
- Run the Naming Server:
make ns
- Run the Client:
For local server:For any other setup, just replacemake cl
./client <IPOFSERVER>with your custom command. - Run the SS:
For local server:For any other setup, just replacemake ss
./storage_server <IP OF SERVER> <ROOT_PATH>with your custom command. - NB:
rm -rf ./backupfolerforssto remove the backfolders in each maching in SS
-
File Operations (
ls,write,cat):
These commands query the Naming Server (NM) for the IP of the Storage Server (SS), then communicate directly with the SS. -
Write Async (
writecommand):
The client specifies a port where it will listen for asynchronous command acknowledgments (ACKs). -
Directory and File Management (
mkdir,touch,rmdir,rm):
These commands are sent to the NM, which processes them, communicates with the appropriate SS, and sends the output back to the client. -
Streaming (
streamcommand):
This command usesffplayto work. Please ensure it is installed on your system. -
Backup and Redundancy: Backup and redundancy mechanisms work in conjunction with caching.
- Maximum Storage Servers: Up to 10 servers.
- Maximum Clients: Unlimited.
- Path Restriction: All accessible paths must be within the directory where the code is running.
- Buffer Size: Default buffer size is 2048 bytes; maximum file size is 4096 bytes (can be adjusted in
helper.h). - Ports: Storage Server and Client ports are assigned automatically, allowing multiple instances to run on the same machine.
- Unique Paths: No SS should have the same root folder as the base accessible directory.
- Backups: All backups are stored in the
backupforssfolder. This folder should not be used as an accessible path. - Root Folder Protection: Do not copy or remove root folders.
- User Assumptions: We trust that users will treat the code with love and care. ❤️
- Rudra Choudhary
- George Rahul
- Aditya Chandramouli Vadali
- Manoj