Author Topic: <SOLVED> retaining "date last saved" information when copying files using Samba  (Read 1497 times)

Offline fraxinus

  • Hero Member
  • *****
  • Posts: 518
Dear friends,

A few months ago, I acquired an Iomega 097bb8 NAS drive, connected to my router by ethernet cable. It took me a long time to understand Samba, but eventually I had it set up so that it worked smoothly. I have now copied huge quantities of photos, documents and other data and I can share this data between various Linux installations and VMs (nearly all Linux, but some Windows) on my network. So far, so good. However (after a few months of cheerfully using my new system), I have just realised that not all is well.

When running Linux, if I copy a file or directory to my NAS using Samba, it loses the 'date last saved/modified' information and simply replaces it with the date/time of the copying operation. This can be a real headache. A colleague on a collaborative project asked me to identify a series of files that had been saved within a particular date-span about three years ago. This information has gone from the copies of the files on my NAS, which now only bear the date at which I transferred them to the external drive! I am very fortunate in having a CD backup which I can use to look this up.

Interestingly, the few files that I have copied to my Iomega drive from Windows retain the 'date last saved' information when browsed on the NAS ...

Is there any way of using or configuring Samba so that this problem does not arise? Or am I best off using my virtual install of Windows for all important data transfers to my NAS in future?

I'd be really grateful for any suggestions or comments. I am using Samba 3.0.33-1 on PCLinuxOS 2009.

EDIT - the files which copied without their date stamps were transferred to the NAS by drag-and-drop using Konqueror.
« Last Edit: August 24, 2010, 03:39:35 AM by fraxinus »

smcs_steve

  • Guest
Re: retaining "date last saved" information when copying files using Samba
« Reply #1 on: August 23, 2010, 05:37:12 AM »
Have you tried rsync?

Offline fraxinus

  • Hero Member
  • *****
  • Posts: 518
Re: retaining "date last saved" information when copying files using Samba
« Reply #2 on: August 23, 2010, 06:12:59 AM »
Have you tried rsync?

Thank you Steve! Well, I have now. Error output as follows, after a test transfer of a few files from one of my FAT32 partitions to the NAS using grsync. I set the option 'preserve time' in the Basic options tab.

Code: [Select]
rsync: failed to set times on "/mnt/backups/New Folder/.": Operation not permitted (1)
rsync: failed to set times on "/mnt/backups/New Folder/.AR Text 140410 - sent to TM.doc.F9Jzab": Operation not permitted (1)
rsync: failed to set times on "/mnt/backups/New Folder/.SPAR Annual Report 09-10 edit imogen 200410.doc.1NVvK8": Operation not permitted (1)
rsync: failed to set times on "/mnt/backups/New Folder/.SPAR Annual Report 09-10 edited World Tree.doc.nHGzr6": Operation not permitted (1)
rsync: failed to set times on "/mnt/backups/New Folder/.SPAR Annual Report 09-10 instalment 1 engagement.X3xve4": Operation not permitted (1)
rsync: failed to set times on "/mnt/backups/New Folder/.SPAR Annual Report 09-10 instalment 1 engagement.doc.DESX71": Operation not permitted (1)
rsync: failed to set times on "/mnt/backups/New Folder/.SPAR Annual Report 09-10 instalment 2 edited World Tree.doc.iRXU5Z": Operation not permitted (1)
rsync: failed to set times on "/mnt/backups/New Folder/.Styleguide 31.xls.mUw5aY": Operation not permitted (1)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1042) [sender=3.0.7]

i.e. looks like I have a Samba permissions problem of some kind.

Offline fraxinus

  • Hero Member
  • *****
  • Posts: 518
Re: retaining "date last saved" information when copying files using Samba
« Reply #3 on: August 23, 2010, 11:39:36 AM »
Thanks for your help, _steve. With the aid of rsync's error messages I think I have now answered my own question by examining /etc/fstab and /etc/samba/smb.conf.

I suspect the problem was due to the fact that Samba and the cifs filesystem on my NAS, between them, were not coping with the user/group permissions on my files.

The entries for each network share in fstab were originally like this:
//192.168.0.4/photos   /mnt/photos   cifs   user=trevor,password=[password]    0   0

I have examined the fstab entry used to mount the FAT32 data partition on my PC (i.e. another partition with a 'permissions insensitive' disc format), and edited my network share entries so that they take this form:
//192.168.0.4/photos   /mnt/photos   cifs   rw,user,auto,uid=trevor,password=[password],gid=users     0   0

NOW I can copy files to my NAS and they retain their date stamps - at least on my tests so far!
« Last Edit: August 23, 2010, 04:01:00 PM by fraxinus »