I have Ubuntu Server 16.04 installed with Samba on another computer in my network. The Ubuntu OS is on a small SSD and I have 2 additional harddrives mounted to /media/drive1 and /media/drive2.

Now I as far as I know I have 2 options in making these drives accessible from my Windows PC:

  • Make 2 Samba shares, one for each drive
  • Make 1 Samba share, of the complete /media/ folder

Currently my goal is to copy data from drive 1 to drive 2 (so locally on the server), from the comfort of Explorer on my Windows desktop.

If I make 2 shares, one for each drive, the local copy speed is simply impossible to work with. It ranges around 20-50 KB/s with rare spikes to 1-1.5 MB/s and every 20 or so seconds it just dies and stalls at 0.

From what I've read I now assume this is because the files first have be copied to my windows desktop and be re-uploaded to the server. I guess that 2 shares aren't interpreted as 'local' anymore. Why it completely stalls out though I don't understand.

If I make 1 share, with the entire /media/ directory, I get problems with 'insufficient disk space' when trying to copy files from drive 1 to drive 2, even though there is plenty space. I can copy 80 GB at a time, but never more than 80 GB at once. The speed when copying this way is normal though, around 70-80 MB/s with some spikes to 90 MB/s +.

I now discovered that this happens because Samba checks the available space on drive of the directory you point at, in this case /media, and this folder is on the small SSD. The SSD only has 80 GB free space, so the math checks out.

So I guess the question is, any way to solve this so I can have the best of 2 worlds? I'd like to be able to copy files within the server from one disk to the other without having these limitations, from the comfort of my desktop windows explorer.

Appendix: This is the template I use to create my shares in smb.conf The authentication and access and such all work, no issues.

[Drive1]
    comment = Drive1
    path = /media/drive1
    browsable = yes
    guest ok = no
    valid users = @samba
    read only = no
    create mask = 0755
share|improve this question

It will be nasty workaround: create file /usr/local/bin/dfree_Drive.sh

#!/bin/bash
df | egrep '/media/drive[0-9]+$' | awk '{total+=$2; avail+=$4; print $0} END{print total, avail}'

and make it executable. Then in share section of your samba configuration add:

    dfree command = /usr/local/bin/dfree_Drive.sh

This solution is nasty, because it lies to client about capacity of shared volume. But as far as I know there is no way to make samba aware of capacity of specific folder (in contrast to volume).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.