Linux

通過 SAMBA 共享將文件從 Linux Mint 18 複製到 Windows 10 非常慢

  • March 20, 2020

我在用作文件伺服器的 Linux Mint 18 機器上設置了 SAMBA 共享,並且我正在嘗試將文件從共享複製到 Windows 10 機器。兩台機器都連接到乙太網。在 Windows 10 複製對話框中,我看到速度在 700KB/s 和 2.3MB/s 之間變化,並且複制約 20GB 文件的剩餘時間估計為 4 多個小時。

我從 Linux Mint 18 盒子共享的文件位於通過 USB 連接並使用 fstab 安裝的外部硬碟驅動器上。這是我的 fstab(它是 Seagate Backup Plus Drive):

~$ cat /etc/fstab
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during installation
UUID=c1b47d55-b3a8-422d-a10b-2ecc6d5e5c83 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
UUID=464a16f6-0ed3-4f66-883c-d28e27479c3a none            swap    sw              0       0

# Seagate Backup Plus Drive
UUID=1E1280D31280B0F7   /mnt/media  ntfs-3g auto,users,permissions  0   0

由於驅動器是外部驅動器,我預計它會比內部 SSD 慢,但速度測試表明它不是瓶頸:

~$ sudo dd if=/dev/sdb of=tempfile bs=102400 count=1024
1024+0 records in
1024+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.703176 s, 149 MB/s

149MB/s 比 2MB/s 快很多。我對這種傳輸速度非常滿意。

我的 Linux Mint 18 盒子中的網卡是Qualcomm Atheros AR8161 Gigabit Ethernet (rev 10),我安裝了alx驅動程序:

~$ modinfo alx
filename:       /lib/modules/4.13.0-32-generic/kernel/drivers/net/ethernet/atheros/alx/alx.ko
license:        GPL
description:    Qualcomm Atheros(R) AR816x/AR817x PCI-E Ethernet Network Driver
author:         Qualcomm Corporation, <nic-devel@qualcomm.com>
author:         Johannes Berg <johannes@sipsolutions.net>
srcversion:     15DC599B88652387E1F807D
alias:          pci:v00001969d000010A0sv*sd*bc*sc*i*
alias:          pci:v00001969d000010A1sv*sd*bc*sc*i*
alias:          pci:v00001969d00001090sv*sd*bc*sc*i*
alias:          pci:v00001969d0000E0B1sv*sd*bc*sc*i*
alias:          pci:v00001969d0000E0A1sv*sd*bc*sc*i*
alias:          pci:v00001969d0000E091sv*sd*bc*sc*i*
alias:          pci:v00001969d00001091sv*sd*bc*sc*i*
depends:        mdio
intree:         Y
name:           alx
vermagic:       4.13.0-32-generic SMP mod_unload

這是關於我的乙太網連接的資訊:

~$ sudo ethtool enp2s0
Settings for enp2s0:
Supported ports: [ TP ]
Supported link modes:   10baseT/Half 10baseT/Full 
                       100baseT/Half 100baseT/Full 
                       1000baseT/Full 
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Advertised link modes:  10baseT/Half 10baseT/Full 
                       100baseT/Half 100baseT/Full 
                       1000baseT/Full 
Advertised pause frame use: Symmetric
Advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
MDI-X: Unknown
Current message level: 0x000060e4 (24804)
              link ifup rx_err tx_err hw wol
Link detected: yes

這就是我的 smb.conf 的樣子:

~$ testparm
# Global parameters
[global]
server string = %h server (Samba, Ubuntu)
security = USER
map to guest = Bad User
syslog = 0
log file = /var/log/samba/log.%m
name resolve order = bcast host
dns proxy = No
panic action = /usr/share/samba/panic-action %d
idmap config * : backend = tdb

[MyShare]
path = "/mnt/media/My Share"
force user = nobody
read only = No
guest ok = Yes

我想使用 Linux Mint 18 作為我正在編輯的影片文件的備份點,我需要更快的傳輸速度才能實現這一點。

如果我可以提供更多有用的資訊,請告訴我。

更新: 網際網路上的一些人建議嘗試使用不同的協議進行傳輸。我在 Windows 機器上使用 SFTP 客戶端從 Linux Mint 18 機器傳輸大文件,發現傳輸速度略高於 SAMBA,但仍達到 2.1MiB/s 的峰值。這讓我相信桑巴可能沒有錯。

我嘗試將一個大文件從我的外部驅動器(我通過 SAMBA 共享的 Seagate Backup Plus 驅動器)移到安裝 Linux Mint 18 的內部驅動器上。然後我重複了 SFTP 測試,發現傳輸速度達到了 2.9MiB/s 的峰值。這向我表明問題可能不是 SAMBA 或外部驅動器,而是我的網路設置中的問題。

好吧,我不覺得自己很傻。事實證明,在 Windows 機器上啟用了 Wifi。一旦我禁用它,SAMBA 傳輸速度就躍升到了 ~11.1MB/s。

引用自:https://serverfault.com/questions/896671