[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:
alex@saturn:/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":
alex@saturn:/tmp$ cp --preserve=timestamps
/media/flash/dcim/100canon/img_0300.jpg ./img_0300.jpg.cp
All looks OK:
alex@saturn:/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:
alex@saturn:/tmp$ cd
I'm on an NFS mount now:
alex@saturn:~$ pwd -P
/mnt/nfs/kronos/u1/home/alex
alex@saturn:~$ 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":
alex@saturn:~$ cp --preserve=timestamps
/media/flash/dcim/100canon/img_0300.jpg ./img_0300.jpg.cp
"Modify" date has become the current time:
alex@saturn:~$ 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
alex@saturn:~$ date
Sun Jun 18 20:19:51 BST 2006
Now use "rsync -t" to copy the file instead:
alex@saturn:~$ rsync -t /media/flash/dcim/100canon/img_0300.jpg
./img_0300.jpg.rsync
"Modify" date has been preserved:
alex@saturn:~$ 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:
ex@saturn:~$ 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.
alex@saturn:~$ 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.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Problems using "cp" and preserving timestamps (Debian, linux 2.6.15),
Alex <=