{"id":22665263,"url":"https://github.com/volkansah/optimize-samba-settings","last_synced_at":"2026-01-07T08:04:49.262Z","repository":{"id":189922516,"uuid":"606604511","full_name":"VolkanSah/optimize-Samba-settings","owner":"VolkanSah","description":"Some tips to speed up Samba (SMB) Server","archived":false,"fork":false,"pushed_at":"2024-11-11T13:07:21.000Z","size":43,"stargazers_count":26,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-12-09T13:36:08.218Z","etag":null,"topics":["samba","samba-server","server-environment","smb-compression","tunning"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VolkanSah.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["volkansah"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"custom":null}},"created_at":"2023-02-26T01:28:03.000Z","updated_at":"2024-12-08T14:34:21.000Z","dependencies_parsed_at":"2024-07-30T13:33:00.373Z","dependency_job_id":"640a5c2a-7ab0-4874-84c6-75d9584b760c","html_url":"https://github.com/VolkanSah/optimize-Samba-settings","commit_stats":null,"previous_names":["volkansah/optimize-samba-settings"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VolkanSah%2Foptimize-Samba-settings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VolkanSah%2Foptimize-Samba-settings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VolkanSah%2Foptimize-Samba-settings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VolkanSah%2Foptimize-Samba-settings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VolkanSah","download_url":"https://codeload.github.com/VolkanSah/optimize-Samba-settings/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237041310,"owners_count":19245490,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["samba","samba-server","server-environment","smb-compression","tunning"],"created_at":"2024-12-09T13:29:47.757Z","updated_at":"2025-02-04T00:47:10.563Z","avatar_url":"https://github.com/VolkanSah.png","language":null,"funding_links":["https://github.com/sponsors/volkansah"],"categories":[],"sub_categories":[],"readme":"\n# Optimize your Samba Server \n### update 2024\n\nBy following these tips, you can optimize your Samba Server and provide a faster and more reliable file sharing service for your users.\n\u003e **⚠️ Warning:**  \n\u003e These settings are for advanced users only. Misconfigurations **will** damage your system. Always make a backup of your `smb.conf` file before making changes.\nNote: These configurations are specifically designed for a Samba Server environment, not for consumer-grade NAS devices or systems where SMB is simply passing data packets throug!\n\n\n## Table of Contents\n- [Basics](#basics)\n  - [Use the latest version of Samba](#use-the-latest-version-of-samba)\n  - [Use the appropriate SMB protocol version](#use-the-appropriate-smb-protocol-version)\n  - [Configure the network settings](#configure-the-network-settings)\n  - [Optimize Samba settings](#optimize-samba-settings)\n  - [Use an appropriate file system](#use-an-appropriate-file-system)\n  - [Use a caching solution](#use-a-caching-solution)\n  - [Enable Asynchronous I/O](#enable-asynchronous-io)\n  - [Use Modern Compression](#use-modern-compression)\n  - [Enable Multi-Channel Support](#enable-multi-channel-support)\n  - [Optimize for SSD/NVMe Storage](#optimize-for-ssdnvme-storage)\n  - [Regularly Monitor and Tune Performance](#regularly-monitor-and-tune-performance)\n  - [Use the Latest Kernel](#use-the-latest-kernel)\n- [Advanced Settings](#advanced-settings)\n  - [Socket options](#socket-options)\n  - [Read raw and write raw](#read-raw-and-write-raw)\n  - [SMB encrypt](#smb-encrypt)\n  - [Max protocol](#max-protocol)\n- [Only for Advanced Users (can damage your system)](#only-for-advanced-users-can-damage-your-system)\n  - [Example smb.conf file](#example-smbconf-file)\n\n## Basics\n\n### Use the latest version of Samba\nUsing the latest version of Samba can help ensure that you are using the most up-to-date and optimized code. You can check for the latest version of Samba on the official Samba website.\n\n### Use the appropriate SMB protocol version\nSMB supports multiple protocol versions, including SMBv1, SMBv2, and SMBv3. Using the latest protocol version that is supported by your clients and server can improve performance and security. You can configure the SMB protocol version in the Samba configuration file (/etc/samba/smb.conf).\n\n### Configure the network settings\nConfiguring the network settings on your clients and server can help improve performance. For example, using a wired Ethernet connection instead of a wireless connection can provide a faster and more stable network connection. You can also optimize the network settings in the Samba configuration file.\n\n### Optimize Samba settings\nThere are several Samba settings that you can optimize to improve performance, such as increasing the socket options, setting the read raw and write raw options to yes, and disabling SMB packet signing. You can configure these settings in the Samba configuration file.\n\n### Use an appropriate file system\nUsing an appropriate file system on your server can also help improve performance. For example, using an SSD or NVMe drive can provide faster read and write speeds than a traditional hard drive. You can also consider using a file system that is optimized for Samba, such as the Samba File System (SFS).\n\n### Use a caching solution\nUsing a caching solution, such as Samba's built-in VFS cache or an external caching solution like memcached, can help improve performance by reducing the number of disk accesses needed to serve requests.\n\n### Enable Asynchronous I/O\nEnabling asynchronous I/O (AIO) can improve performance by allowing the server to handle multiple I/O operations simultaneously. You can enable AIO in the Samba configuration file.\n\n```shell\naio read size = 1\naio write size = 1\n```\n\n### Use Modern Compression\nModern compression algorithms can significantly reduce the amount of data transmitted over the network. You can enable SMB compression in Samba.\n\n\n```shell\nsmb compression = yes\n```\n - Enables SMB compression, which can significantly reduce the amount of data transmitted over the network.\n - Supported on Windows 10 and Windows Server 2019 or later.\nPlease read this! -\u003e https://learn.microsoft.com/en-us/windows-server/storage/file-server/smb-compression\n\n### Enable Multi-Channel Support\nSMB3 introduced multi-channel support, which allows the use of multiple network connections for a single SMB session, increasing throughput and redundancy.\n\n```shell\nserver multi channel support = yes\n```\n - Enables SMB3 multi-channel support, which allows the use of multiple network connections for a single SMB session, increasing throughput and redundancy.\n - Supported on Windows Server 2012 R2 and later.\n\n### Optimize for SSD/NVMe Storage\nIf you are using SSD or NVMe storage, you can further optimize Samba by adjusting settings specific to high-speed storage solutions.\n\n```shell\nwrite cache size = 10485760\n```\n\n### Regularly Monitor and Tune Performance\nRegular monitoring of your Samba server's performance can help identify bottlenecks and areas for improvement. Use tools like \\`smbstatus\\`, \\`iotop\\`, and \\`htop\\` to monitor Samba activity and system performance.\n\n### Use the Latest Kernel\nThe Linux kernel receives numerous updates and performance improvements. Using the latest stable kernel can provide better performance and hardware support for your Samba server.\n\n## Advanced Settings\n\n### Socket options\nThe socket options setting controls various socket options for the connection between the server and clients. You can increase the SO_RCVBUF and SO_SNDBUF values to increase the size of the receive and send buffers, respectively. This can help improve performance by allowing more data to be sent and received at once. Here's an example:\n\n```shell\nsocket options = SO_RCVBUF=8192 SO_SNDBUF=8192\n```\n\n### Read raw and write raw\nThe read raw and write raw settings control whether Samba uses raw mode for reading and writing data. When set to yes, Samba bypasses the standard I/O buffering and caching mechanisms, which can help improve performance. Here's an example:\n\n```shell\nread raw = yes\nwrite raw = yes\n```\n\n### SMB encrypt\nThe smb encrypt setting controls whether SMB packet encryption is used. When set to desired or required, all SMB packets are encrypted, which can help improve security but may decrease performance. You can set this to off if performance is more important than security. Here's an example:\n\n```shell\nsmb encrypt = off\n```\n\n### Max protocol\nThe max protocol setting controls the maximum SMB protocol version that Samba will use. Setting this to the latest version that is supported by your clients and server can help improve performance and security. Here's an example:\n\n```shell\nmax protocol = SMB3\n```\n\nYou can also adjust other settings in the smb.conf file to further optimize Samba performance. Be sure to test any changes in a non-production environment before making them on your production server.\n\n\u003e **⚠️ Warning:**  \n\u003e These settings are for advanced users only. Misconfigurations can damage your system. Always make a backup of your `smb.conf` file before making changes.\n\n### Example smb.conf file\nAn example smb.conf file that is optimized for performance:\n\n```shell\n[global]\n; Set socket options to optimize network performance\nsocket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536\n\n; Enable raw read operations\nread raw = yes\n\n; Enable raw write operations\nwrite raw = yes\n\n; Set the maximum SMB protocol version to SMB3\nmax protocol = SMB3\n\n; Require server signing for all communications\nserver signing = mandatory\n\n; Require encryption for all SMB communications\nsmb encrypt = required\n\n; Enable strict allocation of file space\nstrict allocate = yes\n\n; Enable opportunistic locking\noplocks = yes\n\n; Enable kernel-level opportunistic locking\nkernel oplocks = yes\n\n; Disable POSIX locking\nposix locking = no\n\n; Ensure data is always synchronized with disk\nsync always = yes\n\n; Use the sendfile system call for sending files\nuse sendfile = yes\n\n; Set the minimum size for receivefile operation\nmin receivefile size = 16384\n\n; Set the size of the write cache\nwrite cache size = 2097152\n\n; Set the time in minutes before an idle connection is terminated\ndeadtime = 15\n\n; Set the maximum transmit packet size\nmax xmit = 65535\n\n; Enable large read and write operations\nlarge readwrite = yes\n\n; Set the maximum size of the log file in kilobytes\nmax log size = 2048\n\n; Set the logging level (1 = minimal logging)\nlog level = 1\n\n[share1]\n; Path to the shared directory\npath = /path/to/share1\n\n; Allow read and write access to valid users\nread only = no\n\n; Specify valid users who can access the share\nvalid users = user1\n\n; Specify users who have write access to the share\nwrite list = user1\n\n```\n\nThis example smb.conf file includes some of the settings mentioned earlier, such as socket options, read raw, write raw, and max protocol. It also includes other settings to further optimize Samba performance, such as sync always, use sendfile, and large readwrite.\n\nNote that this is just an example configuration, and you may need to adjust the settings based on your specific environment and requirements. Also, be sure to test any changes in a non-production environment before making them on your production server.\n\n## Credits\n**Volkan Sah**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvolkansah%2Foptimize-samba-settings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvolkansah%2Foptimize-samba-settings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvolkansah%2Foptimize-samba-settings/lists"}