How to configure SMB compression for faster network file transfers on Windows 11

<!–

–>

On Windows 11, “SMB compression” is a feature designed to request file compression during a transfer over the network. The idea of this feature is to make file transfers fasters and reducing bandwidth for large files without having to compress files at the source and then decompress the contents at the destination.

Usually, you would see the benefit of SMB compression on networks with less bandwidth. For example, on devices with 1Gbps Ethernet or Wi-Fi adapters. On the other hand, if you have, for example, two servers with 100Gbps network adapters with Solid-State Drives (SSDs), you may not see the benefit of SMB compression. In practice, it may even take more time.

Compression with SMB on Windows 11 supports algorithms XPRESS (LZ77), XPRESS Huffman (LZ77+Huffman), LZNT1, or PATTERN_V1*. XPRESS is used automatically, SMB signing and SMB encryption, SMB signing and SMB encryption, and SMB Multichannel, but it doesn’t support SMB Direct over RDMA.

In this guide, you will learn the different ways to configure SMB compression to make file transfers faster between computers and servers in the network.

Configure SMB compression for mapped drives (client) on Windows 11

You can configure SMB compression from the device acting as a client or as a server.  The steps below are meant to configure a client computer to request compression for a network folder mapped to Windows 11.

1. Request compression using Command Prompt

To map a shared folder requesting SMB compression with Command Prompt:

  1. Open Start on Windows 11.

  2. Search for Command Prompt, and click the top result to open the app.

  3. Type the following command to map a network folder requesting compression and press Enter:

    net use * \\file-server\share-folder /requestcompression:yes

    net use with SMB compression

    In the command, make sure to specify the path to the network folder you want to mount. The asterisk (*) assigns the drive letter automatically, but you can change it to anything you want.

Once you complete the steps, as you transfer files to the network folder, Windows 11 will try to compress the contents to speed up the transfer.

2. Request compression using PowerShell

To map a shared folder requesting compression with PowerShell commands:

  1. Open Start.

  2. Search for PowerShell, and click the top result to open the app

  3. Type the following command to map a network folder requesting compression and press Enter:

    New-SmbMapping -LocalPath "Z:" -RemotePath "\\file-server\share-folder" -CompressNetworkTraffic $true

    PowerShell map drive with SMB compression

    In the command, remember to update “Z:” for the drive letter and specify the path to the network folder you want to mount and enable compression.

After you complete the steps, compression will occur to speed up the transfer of files. The file share will mount when you use this method, but it may not appear in File Explorer.

Configure SMB compression for mapped drives (server) on Windows 11

It’s also possible to create a file share with SMB compression turned on so that client devices can take advantage of the improved file transfers without having to configure every device, only the server.

.Windows_Software_Technology-Big-343 { display:inline-block; width: 300px; height: 600px; } @media(min-width: 500px) { .Windows_Software_Technology-Big-343 { width: 300px; height: 600px;} }

1. Create new share with compression

To create a network folder with SMB compression:

  1. Open Start.

  2. Search for PowerShell, right-click the top result, and select the Run as administrator option.

  3. Type the following command to create a folder to share in the network and press Enter:

    New-Item -Path "c:\" -Name "folder-name" -ItemType "directory"
  4. Type the following command to create a new file share folder with SMB compression and press Enter:

    New-SmbShare -Name "file-share-name" -Path "C:\file-share-name" -CompressData $true

    PowerShell create network share with SMB compression

    In the command, make sure to update the name of the share and path with your information.

Once you complete the steps, computers in the network will be able to transfer files at higher speeds using compression without additional configuration from the client-side.

2. Edit existing share with compression

To enable SMB compression on existing shared folders on a server:

  1. Open Start.

  2. Search for PowerShell, right-click the top result, and select the Run as administrator option.

  3. Type the following command to configure a shared folder to request compression and press Enter:

    Set-SmbShare -Name "file-share-name" -CompressData $true

    Enable SMB compression

    In the command, remember to specify the name of the existing file share you have to update.

  4. Type Y and press Enter to continue.

After you complete the steps, the existing shared folder will enable SMB compression.

Configure SMB compression for Robocopy on Windows 11

To use compression when copying files with Robocopy:

  1. Open Start.

  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.

  3. Type the following command to copy files over the network with SMB compression and press Enter:

    robocopy c:\source\path\folder \\destination\path\folder /compress

    Robocopy SMB compression enabled

    In the command, remember to specify the source and destination paths for the paths in your environment.

Once you complete the steps, copying files from the source to the destination should be noticeable faster, thanks to SMB compression.

Configure SMB compression for Xcopy on Windows 11

To use SMB compression when copying files with Xcopy:

  1. Open Start.

  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.

  3. Type the following command to copy files over the network with SMB compression and press Enter:

    xcopy c:\source\path\folder \\destination\path\folder /compress

    Xcopy SMB compression enabled

    In the command, remember to specify the source and destination paths for the paths in your environment.

After you complete the steps, file transfer between the source and destination will be a lot faster as a result of compression, making the files smaller during the operation.

SMB compression is available on Windows 11 and Windows Server 2022. Also, by default, the algorithm will attempt to compress the 500MiB of a file and monitors the first 100MiB of the starting amount. If less than 100MiB is compressible, the compression will stop, and the transfer will continue without further compression. However, Microsoft is tweaking the algorithm for the next update of Windows 11 so that the feature will always attempt to compress when the compression is requested.

Post a Comment