[SLE] Files modified while copying from USB-card
Hello all! I have this script that copies all files from my digital camera into a new folder upon execution. But now and again (Not always) i get an error like: cp: skipping file `/media/usbdisk/dcim/100pentx/imgp0099.jpg', as it was replaced while being copied The card is automounted and not touched while the script is ran. So why is the filesystem on the card touched and (apparently) changed? This is /var/log/messages during the session: Jun 20 21:02:26 sparhawk kernel: SCSI device sda: 1998848 512-byte hdwr sectors (1023 MB) Jun 20 21:02:26 sparhawk kernel: sda: Write Protect is off Jun 20 21:02:26 sparhawk kernel: sda: Mode Sense: 02 00 00 00 Jun 20 21:02:26 sparhawk kernel: sda: assuming drive cache: write through Jun 20 21:02:26 sparhawk kernel: SCSI device sda: 1998848 512-byte hdwr sectors (1023 MB) Jun 20 21:02:26 sparhawk kernel: sda: Write Protect is off Jun 20 21:02:26 sparhawk kernel: sda: Mode Sense: 02 00 00 00 Jun 20 21:02:26 sparhawk kernel: sda: assuming drive cache: write through Jun 20 21:02:26 sparhawk kernel: sda: sda1 Jun 20 21:02:28 sparhawk hal-subfs-mount[9228]: SYMLINKS:: disk/by-id/usb-Generic_STORAGE_DEVICE disk/by-path/usb-0x05e3-0x0705:0:0:0 Jun 20 21:02:28 sparhawk hal-subfs-mount[9228]: MOUNT_POINT:: /media/usbdisk Jun 20 21:02:28 sparhawk hal-subfs-mount[9228]: MOUNTPOINT:: /media/usbdisk Jun 20 21:02:28 sparhawk hal-subfs-mount[9228]: Collected mount options and Called(0) /bin/mount -t subfs -o fs=floppyfss,sync,procuid,nosuid,nodev,exec,utf8=true /dev/sda1 "/media/usbdisk" Jun 20 21:02:28 sparhawk udevd[2231]: get_netlink_msg: no ACTION in payload found, skip event 'mount' Jun 20 21:02:31 sparhawk udevd[2231]: get_netlink_msg: no ACTION in payload found, skip event 'umount' Jun 20 21:02:32 sparhawk udevd[2231]: get_netlink_msg: no ACTION in payload found, skip event 'mount' Jun 20 21:02:35 sparhawk udevd[2231]: get_netlink_msg: no ACTION in payload found, skip event 'umount' Jun 20 21:02:57 sparhawk udevd[2231]: get_netlink_msg: no ACTION in payload found, skip event 'mount' --- This is where the script is ran. --- Jun 20 21:06:19 sparhawk udevd[2231]: get_netlink_msg: no ACTION in payload found, skip event 'umount' Jun 20 21:06:19 sparhawk udevd[2231]: get_netlink_msg: no ACTION in payload found, skip event 'mount' Jun 20 21:08:54 sparhawk udevd[2231]: get_netlink_msg: no ACTION in payload found, skip event 'umount' Jun 20 21:08:55 sparhawk udevd[2231]: get_netlink_msg: no ACTION in payload found, skip event 'mount' Jun 20 21:09:21 sparhawk udevd[2231]: get_netlink_msg: no ACTION in payload found, skip event 'umount' Jun 20 21:14:59 sparhawk udevd[2231]: get_netlink_msg: no ACTION in payload found, skip event 'mount' Jun 20 21:15:03 sparhawk udevd[2231]: get_netlink_msg: no ACTION in payload found, skip event 'umount' Jun 20 21:15:17 sparhawk kernel: Device not ready. Make sure there is a disc in the drive. Jun 20 21:15:17 sparhawk kernel: Device not ready. Make sure there is a disc in the drive. Jun 20 21:15:17 sparhawk hal-subfs-mount[11380]: By hald-subfs-mount created dir /media/usbdisk got removed. Jun 20 21:15:48 sparhawk kernel: usb 1-1.2: USB disconnect, address 4 uname -r => 2.6.13-15-default -- /Rikard ----------------------------------------------------------------------------- email : rikard.j@rikjoh.com web : http://www.rikjoh.com mob: : +46 (0)763 19 76 25 ------------------------ Public PGP fingerprint ---------------------------- < 15 28 DF 78 67 98 B2 16 1F D3 FD C5 59 D4 B6 78 46 1C EE 56 >
Hello all! I have this script that copies all files from my digital camera into a new folder upon execution. But now and again (Not always) i get an error like:
cp: skipping file `/media/usbdisk/dcim/100pentx/imgp0099.jpg', as it was replaced while being copied
The card is automounted and not touched while the script is ran. So why is the filesystem on the card touched and (apparently) changed? That error message, as cryptic as it is, seems more like what you'd get if the file already exists in the destination, and cp was run without
On 20/06/06 14:42, Rikard Johnels wrote: the -f (force) option. -- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
On Tuesday 20 June 2006 23:30, Darryl Gregorash wrote:
On 20/06/06 14:42, Rikard Johnels wrote:
Hello all! I have this script that copies all files from my digital camera into a new folder upon execution. But now and again (Not always) i get an error like:
cp: skipping file `/media/usbdisk/dcim/100pentx/imgp0099.jpg', as it was replaced while being copied
The card is automounted and not touched while the script is ran. So why is the filesystem on the card touched and (apparently) changed?
That error message, as cryptic as it is, seems more like what you'd get if the file already exists in the destination, and cp was run without the -f (force) option.
-- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
I doesn't. The destination is freshly made at each pass by the script. It creates a folder 'yymmdd.xx' where 'xx' is an incremented sequential number. So if i run the script twice the same date, it still differs by the last two digits (01,02 etc). So it CAN'T find anything in the target. (Or at least shouldn't) The script is as follows for those who want to debug: maybe not very intelligent or pretty regarding code, but it runs :) (Bits and pieces from helpful ppl here on the list...) -- cut -- #!/usr/bin/perl use strict; use warnings; use File::Path; my $dst_dir = "/mnt/network/dual/hdc/Pictures"; my $src_dir; for(1..10){ { open my $in,"/proc/mounts" or die "$!\n"; $/=undef; ($src_dir) = <$in>=~/ (\S*usbdisk\S*)/; close $in; } last if defined $src_dir; sleep 2; } die "Could not calculate \$src_dir" unless defined $src_dir; my @time = localtime(time); my( $year ) = $time[5]=~/(\d\d)$/; my $month = $time[4]+1; $month="0$month" if $month<10; my $day = $time[3]; $day="0$day" if $day<10; $dst_dir.="/$year/$month/$year$month$day"; my $xx="01"; while( -d "$dst_dir.$xx" ){ $xx++; } $dst_dir.=".$xx"; mkdir $dst_dir or die "$!\n"; mkpath($dst_dir); `cp -r $src_dir/dcim/100pentx/* $dst_dir/`; -- uncut -- -- /Rikard ----------------------------------------------------------------------------- email : rikard.j@rikjoh.com web : http://www.rikjoh.com mob: : +46 (0)763 19 76 25 ------------------------ Public PGP fingerprint ---------------------------- < 15 28 DF 78 67 98 B2 16 1F D3 FD C5 59 D4 B6 78 46 1C EE 56 >
On Wednesday 21 June 2006 00:06, Rikard Johnels wrote:
On Tuesday 20 June 2006 23:30, Darryl Gregorash wrote:
On 20/06/06 14:42, Rikard Johnels wrote:
Hello all! I have this script that copies all files from my digital camera into a new folder upon execution. But now and again (Not always) i get an error like:
cp: skipping file `/media/usbdisk/dcim/100pentx/imgp0099.jpg', as it was replaced while being copied
---- Script and some text removed... The odd and bit scary thing is i tried writeprotecting the SD-card and still get the error from time to time... The mount point /media/usbdisk/ is per automation, and the dcim/100pentx is the folder tree made by tha digital camera. How can a file on a writeprotected filesystem get changed just by a pla8in copy ??? -- /Rikard ----------------------------------------------------------------------------- email : rikard.j@rikjoh.com web : http://www.rikjoh.com mob: : +46 (0)763 19 76 25 ------------------------ Public PGP fingerprint ---------------------------- < 15 28 DF 78 67 98 B2 16 1F D3 FD C5 59 D4 B6 78 46 1C EE 56 >
participants (2)
-
Darryl Gregorash
-
Rikard Johnels