# nfs-rs
[](https://github.com/JayTsu-sh/nfs-rs/actions/workflows/ci.yml)
[](https://crates.io/crates/nfs-rs)
[](https://docs.rs/nfs-rs)
[](LICENSE)
An asynchronous, pure Rust client library for NFSv3, NFSv4.0, and NFSv4.1.
`nfs-rs` implements the NFS client protocol without linking to a C NFS
implementation. It is intended for applications that need to access NFS
exports directly from Rust, including services that cannot rely on a
kernel-mounted filesystem.
## Status
- NFSv3 client operations are supported.
- NFSv4.0 (experimental) is supported through the common `Mount` API using an
AUTH_SYS interoperability profile. RPCSEC_GSS/Kerberos is not implemented,
so this release does not claim unconditional RFC 7530 conformance.
- NFSv4.1 client operations are supported.
- NFSv4.2 may be accepted in a URL preference list but is not implemented.
- The library uses Tokio and communicates with the server over TCP.
- Linux is exercised by CI and by the physical NFS integration lab.
The public API is still evolving while the crate is below version 1.0.
## Installation
```toml
[dependencies]
nfs-rs = "0.8.4"
bytes = "1"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
```
The minimum supported Rust version is 1.95.
For Python on Linux x86_64:
```console
python -m pip install nfs-rs
```
See the [Python API guide](docs/python-api.md) for synchronous and asyncio
examples, typing, large-transfer guidance, cancellation and uncertain outcomes,
and the precise first-release support boundaries.
## Example
```rust,no_run
use bytes::Bytes;
use nfs_rs::{OPEN_READ, Result, parse_url_and_mount};
#[tokio::main]
async fn main() -> Result<()> {
let mount = parse_url_and_mount(
"nfs://127.0.0.1/some/export?version=4.1&noresvport=true",
)
.await?;
let created = mount.create_path("hello.txt", Some(0o644)).await?;
nfs_rs::write_all(&*mount, created.fh.clone(), 0, Bytes::from_static(b"hello NFS"))
.await?;
mount.close(created.fh).await?;
let opened = mount.open_path("hello.txt", OPEN_READ).await?;
let contents = mount.read(opened.fh.clone(), 0, 9).await?;
mount.close(opened.fh).await?;
assert_eq!(&contents[..], b"hello NFS");
mount.umount().await?;
Ok(())
}
```
## URL format
```text