1

I'm running a Bash script under Cygwin, but this question applies more broadly.

I have a remote file: //someremoteserver/somefile.db

That "//" path is under Cygwin--it's essentially a UNC pathname on a Windows network (in this case), so call it Samba.

The file is large: 50 GB.

I want to rename it all on the remote end:

mv //someremoteserver/somefile.db //someremoteserver/someotherfile.db

I would like for this to take 5 nanoseconds because it's merely a rename. But it takes two hours. This seems to be because it is actually copying the file through the local machine's memory space--it's moving 50 GB across the LAN (or maybe even 100 GB if it's copy-here copy-there).

Normally on a local system a "mv" is instantaneous regardless of file size because it's only updating the inode/file table.

Is there a good way to do the same thing when the file is on a remote Samba share?

1 Answer 1

0

Normally on a local system a "mv" is instantaneous regardless of file size because it's only updating the inode/file table.

Exactly. I imagine you will want to call rename/mv from the host containing the file system.

1
  • Unfortunately that's impossible here. The local host is backing up to a remote storage point, and then needs to execute an "atomic operation," meaning an instantaneous operation as the final step in making a file "live." That final step needs to be a rename from a hidden/temp filename (used during the large data copy) to the live filename, and again that needs to happen instantaneously on the disk...but the disk is not local to the machine that executes the process.
    – Dan
    May 4, 2013 at 3:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .