Blogs / What Protocol Should You Choose For Your NAS?

What Protocol Should You Choose For Your NAS?

October 13, 2023 • Matthew Duong • Self Hosting; • 6 min read

What Protocol Should You Choose For Your NAS?

Some of you know I run a YouTube channel covering on premises hosting and homelab. Over time, my raw video footage has really grown in size, now exceeding a whopping 4 Terabytes. To manage this deluge of data, I recently embarked on a mission to build my own Network Attached Storage (NAS). I opted for TrueNAS, a powerful open-source software that integrates seamlessly with multiple storage protocols. For this setup, I am upgrading my Dell T20 (originally only with a 2TiB ssd) to 3 x 10TiB drives dedicated to housing my large video files,as well as the existing SSD for the operating system. The important moment in my NAS journey was deciding on the right file sharing protocol, weighing the pros and cons of AFP, SMB, NFS, and iSCSI.

AFP (Apple Filing Protocol)

Introduction and Context

Apple Filing Protocol, or AFP, originated from the Apple ecosystem and has been the go-to for macOS users for a long time. It offers features like Time Machine backups and supports Apple’s native Spotlight search. However, its relevance has declined due Apple dropping support for this protocol. AFP was deprecated in macOS 10.9 Mavericks and AFP server support was removed in macOS 10.11 Big Sur.

AFP illustration

How it works

AFP operates over TCP/IP and uses a client-server model similar to SMB. However, it was optimised for macOS, allowing for unique Apple features. Clients make requests for files or services, and the AFP server responds accordingly. One distinguishing feature is its strong metadata handling, enabling efficient Spotlight searches and seamless Time Machine backups.

Use Cases

  • Time Machine Backup: If you’re a graphic designer working on a Mac, you could use AFP to effortlessly backup your large design files via Time Machine.

  • Content Search: An academic researcher with a large dataset stored on a Mac can use Spotlight search over AFP to quickly locate specific data points or files.

  • Media Library: If you have an old Mac serving as a media centre, AFP would allow easy access to your library for other Mac devices on the same network.

Pros

  • Effortless Backups: Time Machine backups are seamless, particularly useful for Mac-centric environments.

  • Fast Searching: Spotlight search capabilities mean you can quickly locate the files you need.

  • Apple-Specific Features: Strong support for Apple-specific file attributes and metadata handling.

  • Native Integration: Being built for macOS, it generally requires less configuration.

Cons

  • Deprecated: No longer updated or patched for security by Apple.
  • Compatibility Issues: Not ideal if you’re working in a mixed OS environment.
  • Speed: Modern protocols often offer better performance.
  • Lack of Support: Since it’s deprecated, you’re largely on your own for troubleshooting.

Conclusion

Given that AFP is deprecated and lacks cross-platform support, it’s best to avoid it for a modern, versatile NAS setup.

SMB / Samba

Introduction and Context

SMB is a file-sharing protocol originally created by IBM and later adopted mainly by Microsoft. It is widely used for its broad cross-platform compatibility, making it a go-to choice in mixed OS environments.

SMB diagram

How it works

SMB operates over TCP/IP and uses a client-server model. The client requests files or services, and the server provides them. Samba works by translating SMB protocol calls into Linux/Unix calls, enabling seamless interoperability between Windows and non-Windows systems. File locking, access control, and other features are handled transparently, often requiring little to no special configuration.

Use Cases

  • Cross-Platform File Sharing: In an office with both Windows, Linux and macOS systems, SMB and Samba ensure smooth file exchanges among all devices.
  • Printer Sharing: Use SMB to allow multiple corporate users access to network printers, regardless of their operating system. Media Streaming: Utilise SMB for streaming media files from a Linux-based home server (running Samba) to various devices like smart TVs and game consoles. Pros
  • Broad Compatibility: SMB is native to Windows, while Samba extends compatibility to Linux and macOS.
  • Robust Security: Both SMB and Samba offer strong access control and permissions settings.
  • File Locking: Helps prevent file editing conflicts by locking files during use.
  • Ease of Use: SMB is native to Windows and Samba has comprehensive documentation for Linux setups.

Cons

  • Security Concerns: Older versions of SMB have known vulnerabilities; it’s important to keep systems updated.
  • Performance: Might be slower than other specialised protocols for certain tasks.
  • Resource Use: Both SMB and Samba can be more CPU and memory-intensive compared to lighter protocols.

Conclusion

For the vast majority of people, especially those just getting started with NAS, SMB provides a blend of ease and performance that is hard to beat.

NFS (Network File System)

Introduction and Context

NFS is a Unix-based file-sharing protocol known for its high performance and efficiency. While it offers advantages like reduced network overhead and multi-threading support, it demands a nuanced setup and is best-suited for environments with Unix-like systems.

NFS illustration

Use Cases

  • High-Throughput Data Processing: For machine learning tasks that require quick access to large datasets, NFS is a go-to for minimising latency.
  • Video Rendering Farm: If you’re in the media production industry and using Unix-based systems, NFS could significantly expedite rendering times for large video files. Shared Development Environment: DevOps teams running CI/CD pipelines on Unix-based servers might opt for NFS to ensure fast, efficient file access across machines.

Pros

  • Speed: Specialises in high-speed, large file operations, and supports multi-threading.
  • Network Efficiency: Less “chatty” compared to SMB, thus reducing network overhead.
  • Unix Permissions: Allows for fine-grained control over file access with Unix-based permissions.
  • Resource-Efficient: Generally consumes fewer resources compared to other protocols like SMB.

Cons

  • Complex Setup: Requires a deeper technical understanding for optimal configuration.
  • No Native Encryption: A potential drawback if strong security is essential.
  • Limited Cross-Platform Support: Poor native compatibility with Windows and macOS; third-party software often needed.
  • Advanced Features: While powerful, features like access control can add complexity.

Conclusion

NFS excels in high-performance, Unix-like environments but demands technical expertise for setup and management. If your use-case prioritises speed and you’re equipped to handle its complexities, NFS is a strong candidate.

iSCSI (Internet Small Computer Systems Interface)

Introduction and Context

iSCSI is a block-based storage networking protocol that provides high performance and low latency, ideal for applications like databases that require quick read/write access. It’s commonly used in Storage Area Networks (SANs) for efficient storage utilisation.

How It Works

iSCSI works by sending traditional SCSI commands over an IP network. The iSCSI protocol encapsulates these SCSI commands into packets for the TCP/IP layer. This allows two endpoints — the iSCSI initiator (usually a server) and the iSCSI target (the storage array) — to communicate. The initiator treats the remote storage as if it were a local SCSI disk, enabling direct read and write operations at the block level.

iSCSI illustration

Use Cases

  • Database Servers: For real-time transactional systems like financial databases, iSCSI offers the low latency needed for quick data access.
  • Virtualization: Running multiple virtual machines? iSCSI’s low-latency performance makes it a strong choice for virtualized environments. Disaster Recovery: Its features like snapshots and cloning make iSCSI suitable for backup and disaster recovery solutions. Pros
  • Low Latency: Highly beneficial for latency-sensitive applications like databases and VMs.
  • Block-Level Access: Allows for efficient storage utilisation, as it interacts directly with the storage blocks.
  • Advanced Features: Supports functionalities like snapshots and cloning for data recovery and backup.
  • Versatility: Simulates local storage, making it adaptable to a variety of applications.

Cons

  • Setup Complexity: Requires expertise for optimal configuration and may involve dedicated networking.
  • Security Risks: Lacks built-in security features, so isolating iSCSI traffic is crucial for network safety.
  • Resource-Intensive: Optimal performance generally requires dedicated network resources.

Conclusion

iSCSI is best suited for specialised high-performance, low-latency scenarios.

Overall Conclusion

Selecting the appropriate protocol for your NAS is pivotal and largely dictated by your specific use-case. SMB is generally sufficient for most, balancing ease and performance. If speed is crucial, NFS or iSCSI are your go-to options. AFP, once popular in macOS circles, is now outdated and not recommended.

Hardware should also align with your protocol choice to eliminate bottlenecks:

  • Network Speed: A 10Gbps network is advisable for iSCSI or NFS to fully harness their speed capabilities, as opposed to standard 1Gbps links.
  • Disk Type: SSDs offer quicker data access and are advantageous for iSCSI and NFS, especially in RAID configurations like RAID 10 that provide both speed and redundancy.
  • CPU and RAM: SMB and Samba can be resource-intensive; consider a multi-core CPU and at least 16GB of RAM for optimal performance.
  • NIC Features: Look for NICs that support network bonding or link aggregation to further accelerate data transfers.

In summary, protocol choice is just one piece of the puzzle. Ensuring your hardware is on par with your protocol can significantly boost your NAS performance.

© 2023-2024 Matthew Duong