[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: unexpected behavior of cp and mv



Exactly as shown on my screen,  it shows that rsync, when used with -av, works as expected, but cp -pi does not.

$ rm /mnt/u1/rw/receipt/u1.crontab
$ ls -ls /mnt/1g/home/u1/data/u1.crontab /mnt/u1/rw/receipt/u1.crontab
ls: cannot access '/mnt/u1/rw/receipt/u1.crontab': No such file or directory
4 -rw-r--r-- 1 u1 u1 54 Feb  5  2017 /mnt/1g/home/u1/data/u1.crontab
$ cp -pi /mnt/1g/home/u1/data/u1.crontab /mnt/u1/rw/receipt/
$ ls -ls /mnt/1g/home/u1/data/u1.crontab /mnt/u1/rw/receipt/u1.crontab
   4 -rw-r--r-- 1 u1 u1 54 Feb  5  2017 /mnt/1g/home/u1/data/u1.crontab
1024 -rwxr-xr-x 1 u1 u1 54 Apr 30 00:00 /mnt/u1/rw/receipt/u1.crontab
$ rm /mnt/u1/rw/receipt/u1.crontab
$ rsync  /mnt/1g/home/u1/data/u1.crontab /mnt/u1/rw/receipt/
$ ls -ls /mnt/1g/home/u1/data/u1.crontab /mnt/u1/rw/receipt/u1.crontab
   4 -rw-r--r-- 1 u1 u1 54 Feb  5  2017 /mnt/1g/home/u1/data/u1.crontab
1024 -rwxr-xr-x 1 u1 u1 54 Apr 30 00:01 /mnt/u1/rw/receipt/u1.crontab
$ rm /mnt/u1/rw/receipt/u1.crontab
$ ls -ls /mnt/1g/home/u1/data/u1.crontab /mnt/u1/rw/receipt/u1.crontab
ls: cannot access '/mnt/u1/rw/receipt/u1.crontab': No such file or directory
4 -rw-r--r-- 1 u1 u1 54 Feb  5  2017 /mnt/1g/home/u1/data/u1.crontab
$ rsync -av /mnt/1g/home/u1/data/u1.crontab /mnt/u1/rw/receipt/
sending incremental file list
u1.crontab

sent 158 bytes  received 35 bytes  386.00 bytes/sec
total size is 54  speedup is 0.28
$ ls -ls /mnt/1g/home/u1/data/u1.crontab /mnt/u1/rw/receipt/u1.crontab
   4 -rw-r--r-- 1 u1 u1 54 Feb  5  2017 /mnt/1g/home/u1/data/u1.crontab
1024 -rwxr-xr-x 1 u1 u1 54 Feb  5  2017 /mnt/u1/rw/receipt/u1.crontab

On 4/29/20 5:48 PM, songbird wrote:
Alberto Sentieri wrote:
On 4/29/20 4:13 PM, Thomas Schmitt wrote:
Hi,

Alberto Sentieri wrote:
It is clear
there that -p has no effect on that particular case of smb destinations. A
similar problem is happening with mv.
Maybe its not the file copying operation but the subsequent adjustment
of the timestamps.
Did you already try whether you can change timestamps on SMB by e.g.
touch(1) ?
   if touch does work then try using it and the original file
name on the original file system as a reference file.

(see man touch)

   another thing to try would be to see if rsync is also
not doing this correctly.

   sorry, short on time at the moment to dig further but
these two things came immediately to mind.


   songbird



Reply to: