help-gnu-utils
[Top][All Lists]
Advanced

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

Problems using "cp" and preserving timestamps (Debian, linux 2.6.15)


From: Alex
Subject: Problems using "cp" and preserving timestamps (Debian, linux 2.6.15)
Date: Sun, 18 Jun 2006 20:29:36 +0100
User-agent: Thunderbird 1.5.0.2 (X11/20060516)

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:

address@hidden:/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":

address@hidden:/tmp$ cp --preserve=timestamps /media/flash/dcim/100canon/img_0300.jpg ./img_0300.jpg.cp

All looks OK:

address@hidden:/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:

address@hidden:/tmp$ cd

I'm on an NFS mount now:

address@hidden:~$ pwd -P
/mnt/nfs/kronos/u1/home/alex
address@hidden:~$ 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":

address@hidden:~$ cp --preserve=timestamps /media/flash/dcim/100canon/img_0300.jpg ./img_0300.jpg.cp

"Modify" date has become the current time:

address@hidden:~$ 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
address@hidden:~$ date
Sun Jun 18 20:19:51 BST 2006

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

address@hidden:~$ rsync -t /media/flash/dcim/100canon/img_0300.jpg ./img_0300.jpg.rsync

"Modify" date has been preserved:

address@hidden:~$ 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:

address@hidden:~$ 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.
address@hidden:~$ 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]