Is there a way to efficiently move files from a samba share to another, when they are on the same disk ?

Asked by Wladston Viana

I have an "Incoming" samba share on my server, with I use for incoming music, video, and also as a general temporary pastebin. It's a public share, anyone can read/write to it. Also, I've set up another share, a "media" one, that is the actual organized repository of things that I wish to keep. Not everyone has permission to write to that share.

The problem is - when I want to copy a movie, or any other large file from one share to another, it takes a really long time to do it. Looks like it downloads the file, and then uploads it again. When I have to move big files, I often resort to the command line, where the mv command makes the work in seconds.

Is there a way to keep my separate shares, with their different permissions, and also copy files from one samba share to another, at the same time the mv command would take ?

And, should I file a bug report about this issue ?

Thanks!

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Wladston Viana
Solved:
Last query:
Last reply:

This question was reopened

Revision history for this message
Wladston Viana (wladston) said :
#1

Oh - I forgot to mention - when I use the MV command, I use it via SSH, connected directly to the server, without using samba.

Revision history for this message
Ivaylo Ivanov (icefox) said :
#2

mv - command move files from one location to another.
cp - command copy files from one location to another.
Possibly mv will be faster than cp

Revision history for this message
Ivaylo Ivanov (icefox) said :
#3

Opss,i forgot too,connect to server via SSH and replace MV command with CP command.

Revision history for this message
Wladston Viana (wladston) said :
#4

Ivaylo,

The mv command is fast - it just moves the file from one directory to another.

My problem, is when I use Nautilus to move the files, from one share to another, via samba. It can take about 40~30 minutes to move a single 1400MB file, while on the command line via ssh, it does it on seconds.

As I said earlier, I think Nautilus download the file, and then re-uploads it to the server, with is an extremely slow process....

Revision history for this message
Ivaylo Ivanov (icefox) said :
#5

Probably you are right - Nautilus download the file, and then re-uploads it to the server.
If i understand you right,you are mount two different samba devices on your system,i will call they "Public" and "Private".
In this case when you copy file from "Public" to "Private" via your system,it is normal this file to travel: Public -> Your System -> Private

Revision history for this message
Wladston Viana (wladston) said :
#6

Ivaylo,

Yeah, that's it .... I know it is "normal" ... but, isn't there a way to improve this ? It HAS to be on that slow way ?

Revision history for this message
Ivaylo Ivanov (icefox) said :
#7

I'm not sure,but i think that no way to improve this kind of transfer.
Many factors influence on the transfer,like how many users are connected to your network,throughput,network performance,in your case samba server etc.,some of them you can improve.

Revision history for this message
Wladston Viana (wladston) said :
#8

Sure ... But I was wondering if it were possible to have samba to move the files in a matter of seconds, just as the mv command does .... 30 to 40 minutes is way toooo much time!

Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#9

Ssh is the best way to send command to copy or move a file on a remote machine.
You can use ssh to send remote copy command, example:
ssh your_user@your_server_or_ip_name 'mv /home/user/incoming/filename /home/user/media/filename'

HTH

Revision history for this message
Wladston Viana (wladston) said :
#10

Elart, that's what I've been doing ... But the problem is that it's boring to have to open up a terminal, then typing the ssh command, then typing the password, and finally issuing the mv command, and exiting.

It would be much better if I could obtain the same performance that i have using ssh with move command, but using samba. It's really frustrating to have such a poor performance when managing my shares

Revision history for this message
Wladston Viana (wladston) said :
#11

ops, reopening

Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#12

Viana, searching on the Net i found a solution isn't via samba but it is a good solution to do what are you looking for, please visit:
http://www.freesoftwaremagazine.com/articles/ssh_beyond_the_command_line?page=0%2C2

HTH

Revision history for this message
Ivaylo Ivanov (icefox) said :
#13

Wladston try this: Open Places -> Connect to server -> Chose "SSH" mode and add information in required field.
Now you can browse in your samba server via SSH,without to need every time to connect samba via terminal.This is my prefer way to connect in my samba servers.

Revision history for this message
Wladston Viana (wladston) said :
#14

Ivaylo,

Well, that would be a good solution, but the problem is that it doesn't create a "vitual drive" as I was expecting.

When I log in, and hit the "up" button, instead of going back to the shares, it lists the root of my server ...

also, when trying to open/save to the share from others applications (i tried to open a text file with gedit) it hanged ...

It could be a wonderfull solution, if it were better implemented ...

Revision history for this message
Peter L Jones (peter-drealm) said :
#15

The core of the problem is that the client you are using doesn't have any way to determine that the two shares are anything to do with one another. In fact, it probably takes the same approach for everything (read to local store, write from local store), whether the files are on ftp, WebDAV, nfs, samba or physical, local drives on your computer.

There's nothing the server can do to help in that situation. You need a different client... If your remote server had server side tools for managing files, that would immediately solve the problem. Installing one of the many web-based management systems might be a good move, if you can find one with decent file handling (i.e. "pick these files up, move them there"). If you can't using some server-side scripting might fix things up.

Revision history for this message
Wladston Viana (wladston) said :
#16

Peter,

Hum, thanks a lot for the answer! So it turns out that the real flaw is somewhere on nautilus or samba-client. Do you think we should file a bug ? If yes, can you help writing it ?

The idea of the web-based management is awsome, it would even allow me to manage my files when I'm not in home. But I don't know any GUI web based file manager that I can install ... Have you seen any ?

@elart.it,

Looks like it works greatly on windows, but on nautilus, as I said, it's not seen as a share, or as a drive but as a special "location" ... the share is more simple and intive for me (I can go "up" and get back to the list of shares, I can open and save files to it, etc.)

Revision history for this message
Peter L Jones (peter-drealm) said :
#17

No, it's not a bug. It's the design of the clients not to depend on the server implementation, other than "READ DATA" and "WRITE DATA" (and possibly "RENAME FROM" and "RENAME TO"). There is no trivial way to fix the client so it can know that two shares are actually on the same disk on the same server. You're into writing a whole new client-server file system protocol. And the world really doesn't need another.

Most web hosting sites I've seen provide some form of web-based management UI with a file manager. The most common one is cPanel, I should think. Do a google on "web control panel". You'll have to have a web server running, too, of course.

Revision history for this message
Wladston Viana (wladston) said :
#18

Peter,

Ahn, so it's a feature that isn't implementable on samba... ;-(

cPanel would be an overkill for me .... My server just servers me, and all I want is a way to efficiently move my files from one share to another, when needed... searching for web control panel didn't help much, but searching for web file manager did help, althought I couldn't find any application that I felt i was safe to install .. let's home ubuntu home server edition ships soon :)

I'm closing because the reason for the ticket was solved - the only way to move the files is either via ssh or via a web manager application.