# Samba really slow whe resilvering using WD SMR NAS drives.



## Echoxxzz (Jun 13, 2021)

Ever since I upgraded one my servers to FreeBSD 13 my Samba jail is really slow when you first try and open a mapped drive or folder (from a Windows PC) that has lots of files. Compared to my server running FreeBSD 12.2 which is almost instantaneous FreeBSD 13 takes several minutes and often the Windows Explore process just hangs. Even trying to UNRAR some files to a FreeBSD 13 Samba shared folder that has lots of files often doesn't even finish. 

I even tried exporting my jail from my FreeBSD 12.2 host (which works perfectly) and I imported it to my new FreeBSD 13 host and it now runs super slow.

Are there some settings that I need to tweak on FreeBSD 13 (and maybe OpenZFS 2.0) to make Samba perform as good as did on FreeBSD 12.2?


----------



## grahamperrin@ (Jul 10, 2021)

Echoxxzz said:


> … FreeBSD 13 takes several minutes …



That's peculiar. Persistent L2ARC should improve the situation, but let's not jump the gun.

Can you share details about hardware, and so on?


----------



## diizzy (Jul 10, 2021)

I'm actually seeing the opposite (13-STABLE being better than 12.2-RELEASE).
The only issue I've run into (which may be fixed now) is that earlier versions could cause "ghost directories and files" which confused Windows clients.
Adding 
	
	



```
directory name cache size = 0
```
 to smb(4).conf fixed that issue however in general you shouldn't need to tweak pretty much anything but if you want to compare here's my full smb4.conf (do note that I don't run AD).


```
[global]
workgroup = WORKGROUP
server string = Storage Server Foobar
log file = /var/log/samba.log
max log size = 10240
bind interfaces only = true
interfaces = em0
disable netbios = yes
directory name cache size = 0
load printers = no
disable spoolss = yes
printing = bsd
printcap name = /dev/null
unix extensions = no
veto files = /Thumbs.db/.DS_Store/._.DS_Store/.apdisk/
delete veto files = yes
enable core files = no
multicast dns register = no

[pubdata]
comment = Foobar's Storage Pool PubData
path = /array0/pubdata
public = yes
guest ok = yes
writable = yes
write list = someonethatshouldhavewriteaccess
browseable = yes
create mask = 0775
vfs objects = zfsacl
nfs4:mode = special
nfs4:acedup = merge
nfs4:chown = yes
```


----------



## Echoxxzz (Jul 11, 2021)

I found the problem. One of my brand new zpools was doing a resilver and I have no idea why. There is nothing wrong with the disk that it was silvering. If I took that disk offline everything is fast again. This was a new pool that I wasn't even using yet and it had very little data and it was slowing down my other pool (the one with a Samba share). I let it run for several days and it only ever progressed about 7%. Finally just gave up and copied the data to another box and deleted and recreated the pool and copied the data back and now it's fast again. 
Is resilvering supposed to be this slow and have this much impact on performance?


----------



## monwarez (Jul 11, 2021)

Resilvering will put some pressure on the disk io (and cpu too), which can lead to less performance for other disk that share the same bandwidth.
Since the title is unrelated to the subject, could you rename it to something like: 

Samba on FreeBSD13 really slow when there a zpool that is currently resilvering

Resilvering can become very slow with some recent hard drive technologies : SMR (which can be found in a lot of consumer hard drive, even some "NAS" drive are SMR, so you need to take CMR hard drive instead if you want to be able to resilver in less than a week)


----------



## grahamperrin@ (Jul 11, 2021)

monwarez said:


> … Resilvering can become very slow with some recent hard drive technologies : SMR …



Thanks! Reminded me of a 2020 article that I bookmarked, but didn't read, a couple of months ago: 

WD Red DM-SMR Update 3 Vendors Bail and WD Knew of ZFS Issues ▶ We put Western Digital’s dreaded SMR Red drive to the test | Ars Technica


----------



## Echoxxzz (Jul 12, 2021)

That's exactly my problem. The resilvering was going totake  over a month for my 6TB drive. I had no idea that WD was using SMR in it's NAS drive 6TB or lower. I've signed for the Canadian Class Action so hopefully I'll get some compensation for these desktop drives. In the meantime I bought some Seagate Ironwolf drives (which I normally always use) to replace them.


----------



## Echoxxzz (Jul 12, 2021)

monwarez said:


> Resilvering will put some pressure on the disk io (and cpu too), which can lead to less performance for other disk that share the same bandwidth.
> Since the title is unrelated to the subject, could you rename it to something like:
> 
> Samba on FreeBSD13 really slow when there a zpool that is currently resilvering
> ...


I renamed the thread to something more appropriate.


----------

