Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meaning of "near-atomic" transfer using temporary files?

I was reading 'SCP' command man page in linux, in the end it said

"No attempt is made at "near-atomic" transfer using temporary files".

Vaguely I can guess what it is but can anyone clearly tell me the technical definition of this sentence.

Thanks, paddy

like image 588
paddy Avatar asked Feb 26 '13 11:02

paddy


People also ask

Does SCP use temporary files?

Processing satellite images requires a large amount of disk space for temporary files (required for processing but deleted afterward).

How do I SCP to a local remote?

To copy the files you will need to first invoke the SCP, followed by the remote username@IP address, path to file. If you do not specify the path, it is assumed as default in this case which will be the user's home directory, this will be followed the path where the file will be stored locally.

How does SCP work in Linux?

The SCP command or secure copy allows secure transferring of files in between the local host and the remote host or between two remote hosts. It uses the same authentication and security as it is used in the Secure Shell (SSH) protocol. SCP is known for its simplicity, security and pre-installed availability.

Does SCP work over SSH?

The scp command uses SSH to transfer data, so it requires a password or passphrase for authentication. Unlike rcp or FTP, scp encrypts both the file and any passwords exchanged so that anyone snooping on the network cannot view them.


2 Answers

An atomic copy would be as Craig states, to use a temporary file and then mv the temporary file to the intended destination. The mv IS an atomic providing source and destination are on the same partition. Only file operations with the tmp file open already will be able to read the contents. rename() is not atomic on files that move between partitions as the data has to be copied.

This assumes you're scp'ing to a UNIX system of course :)

like image 65
ed neville Avatar answered Nov 04 '22 17:11

ed neville


Atomic would mean that nothing else could read or write the file until scp had finished with it. "Near-atomic" refers to the common practise of copying a file into a temporary location (on the target machine/disk) and then moving it into the final location. The move operation is much faster than a copy ("near-atomic" by comparison) but it's not necessarily atomic in the true sense of the word. Another process could still read the file in an inconsistent state during a non-atomic move.

like image 45
Craig Barnes Avatar answered Nov 04 '22 16:11

Craig Barnes