Hi,

I'm having problems copying from a local partition (vfat) to an NFS mount, preserving timestamps. "cp --preserve=timestamps" will *not* preserve the timestamp, with no error given.
"rsync -t" *will* preserve the timestamp as expected. Here's what I've done:

Looking at the original file:

[EMAIL PROTECTED]:/tmp$ stat /media/flash/dcim/100canon/img_0300.jpg
  File: `/media/flash/dcim/100canon/img_0300.jpg'
  Size: 1807152         Blocks: 3552       IO Block: 16384  regular file
Device: 831h/2097d      Inode: 1458        Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2006-06-18 20:03:50.000000000 +0100
Modify: 2006-04-17 15:07:24.000000000 +0100
Change: 2006-05-01 23:06:24.000000000 +0100

Copying the file to /tmp using "cp --preserve=timestamps":

[EMAIL PROTECTED]:/tmp$ cp --preserve=timestamps /media/flash/dcim/100canon/img_0300.jpg ./img_0300.jpg.cp

All looks OK:

[EMAIL PROTECTED]:/tmp$ stat img_0300.jpg.cp
  File: `img_0300.jpg.cp'
  Size: 1807152         Blocks: 3544       IO Block: 4096   regular file
Device: 801h/2049d      Inode: 7143470     Links: 1
Access: (0755/-rwxr-xr-x)  Uid: ( 1000/    alex)   Gid: (  100/   users)
Access: 2006-06-18 20:03:50.000000000 +0100
Modify: 2006-04-17 15:07:24.000000000 +0100
Change: 2006-06-18 20:10:19.000000000 +0100

Change to my home directory:

[EMAIL PROTECTED]:/tmp$ cd

I'm on an NFS mount now:

[EMAIL PROTECTED]:~$ pwd -P
/mnt/nfs/kronos/u1/home/alex
[EMAIL PROTECTED]:~$ mount
/dev/sda1 on / type ext3 (rw,errors=remount-ro)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
usbfs on /proc/bus/usb type usbfs (rw)
tmpfs on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev type tmpfs (rw,size=10M,mode=0755)
kronos:/u1 on /mnt/nfs/kronos/u1 type nfs (rw,addr=192.168.0.2)
kronos:/u2 on /mnt/nfs/kronos/u2 type nfs (rw,addr=192.168.0.2)
/dev/sdd1 on /media/flash type vfat (rw)

Now copy the file here using "cp --preserve=timestamps":

[EMAIL PROTECTED]:~$ cp --preserve=timestamps /media/flash/dcim/100canon/img_0300.jpg ./img_0300.jpg.cp

"Modify" date has become the current time:

[EMAIL PROTECTED]:~$ stat ./img_0300.jpg.cp
  File: `./img_0300.jpg.cp'
  Size: 1807152         Blocks: 3544       IO Block: 32768  regular file
Device: fh/15d  Inode: 18530655    Links: 1
Access: (0755/-rwxr-xr-x)  Uid: ( 1000/    alex)   Gid: (  100/   users)
Access: 2006-06-18 20:12:45.000000000 +0100
Modify: 2006-06-18 20:19:31.799681001 +0100
Change: 2006-06-18 20:19:31.800680835 +0100
[EMAIL PROTECTED]:~$ date
Sun Jun 18 20:19:51 BST 2006

Now use "rsync -t" to copy the file instead:

[EMAIL PROTECTED]:~$ rsync -t /media/flash/dcim/100canon/img_0300.jpg ./img_0300.jpg.rsync

"Modify" date has been preserved:

[EMAIL PROTECTED]:~$ stat ./img_0300.jpg.rsync
  File: `./img_0300.jpg.rsync'
  Size: 1807152         Blocks: 3544       IO Block: 32768  regular file
Device: fh/15d  Inode: 18538966    Links: 1
Access: (0755/-rwxr-xr-x)  Uid: ( 1000/    alex)   Gid: (  100/   users)
Access: 2006-06-18 20:12:45.000000000 +0100
Modify: 2006-04-17 15:07:24.000000000 +0100
Change: 2006-06-18 20:12:33.082213446 +0100

cp and linux version:

[EMAIL PROTECTED]:~$ cp --version
cp (GNU coreutils) 5.94
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Written by Torbjorn Granlund, David MacKenzie, and Jim Meyering.
[EMAIL PROTECTED]:~$ uname -a
Linux saturn 2.6.15-1-k7 #2 Mon Mar 6 15:42:39 UTC 2006 i686 GNU/Linux

Any ideas please?

Thanks in advance,
Alex.
_______________________________________________
help-gnu-utils mailing list
help-gnu-utils@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-utils

Reply via email to