I noticed that when I copy files to a fat32 partition the date of the new files is different from the date of the source files. In fact it is that of the moment when I copied the files. I don't know if it's a fat32 driver problem or if it's just me being ignorant about mount options... here is the line of the fat32 partition from my fstab:
/dev/hda2 /media/hda2 vfat users,exec,defaults,umask=000,fat=32 0 0
Thanks in advance and sorry if it's just a silly question.
This is normal behavior on UN
This is normal behavior on UNIX-like systems, even for copying files onto native partitions. If you want to preserve the file time and attributes use cp -p.
Thanks, now I know that it's
Thanks, now I know that it's not a problem of the fat32 driver but just a problem of my mount options.
In fact when I try to copy a file on an external usb disk fat32 which is mounted automatically by automount:
me@laptop:~/Desktop$ cp -p pippo /media/usbdisk/
the command cp -p works fine.
Yet, the partition I said above is mounted like this (from my fstab):
/dev/hda2 /media/hda2 vfat users,exec,defaults,umask=000,fat=32 0 0
When I try to copy a file on it:
me@laptop:~/Desktop$ cp -p pippo /media/hda2/
I get a permission error. The file is copied anyway but with the date of the moment I run the cp command.
Ownership
FAT does not support all the permissions and ownership informations that normal unix file systems have. Instead most of this depends on mount options and will be the same for every file on the file system. Probably after copying, the files are no longer owned by you, and thus you don't have permission to change the time stamp.
I had the same problem i.e.
I had the same problem i.e. dates and times were not preserved when copying files to a FAT partition mounted from linux via an fstab entry.
After much frustration, I eventually realised that when I was root dates were correctly preserved, but not when I was logged in as my default username. I am not an expert, by I realised that it has something to do with permissions and ownership on the mounted fat partition.
I got round it by adding the additional parameter 'uid=1000' to the fstab entry. This made my login (1000) the owner of all files (rather than root).
my fstab entry now looks like:
/dev/hda4 /media/hda4 vfat umask=000,shortname=mixed,quiet,iocharset=utf8,uid=1000 0 0
Now both my login, and root, can copy files without corrupting dates and times.
Hope this helps!