"Preserving time: operation not permitted" on fat32 on debian
DebianThis forum is for the discussion of Debian Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
"Preserving time: operation not permitted" on fat32 on debian
Hello.
Anytime I give a mv command, or similar, a fat32 partition as destination, I get a "Preserving time: operation not permitted" error, and the file timestamp is set to current time. The same happens when I download with wget to a fat fs. Running mv as root did not solve.
This may seem not much of a problem, still it's annoying when dealing with backups. Does anybody know if it is a kernel limitation, or what?
THe kernel is not permitting to change the time stamps. Its not the fault of mv.
WHat mounting flags are you using? Whats the entry in /etc/fstab ???
Are you doing these as root? If not, did you mount the fat32 partition or root?
Here's one of the fstab entries: /dev/hdc5 /mnt/data2 vfat iocharset=iso8859-15,codepage=850,umask=0 0 0
I can't change timestamps as root, neither.
What I need to know is: is this a known limitation on fat32 writing, or I have some misconfigured kernel options? I actually run a minimally-adapted vanilla kernel.
Thanks
it's a limitation.... a standard unix filesystem has so so much information in it than crap old fat32... that's why there's the "quiet" option for vfat in fstab.. so it doesn't keep giving these futile error messages.
My current config allows setting the time correct time stamp on the fat partition. for root and ONE user:
As FAT lacks many of the Unix file attributes (esp. owner, group, r/w-attributes) this information is substituted when mounting a fat file system. By default user-id and group-id are 0 (root) and the r/w-attributes are derived from the current umask (usually 022). These default values can be changed by the various mount options (uid, gid, usmask, and - since 2.5.43 - dmask and fmask).
What seems to happen is this:
When copying a file to a fat partition, it gets - during its creation - the default (or defined) 'virtual' user, group ids, attributes and the current time stamp.
It seems that only the owner of a file can change its time stamp (except root, of course).
This means, if your own user id does not match the 'virtual' user-id, cp can not change the file date back to file date the source file.
The solution is clear - find out your user id (XXX), mount the partition with uid=XXX, and all the files on that partition belong to you - even the newly created ones. This way cp -a can set the original file date.
This works, of course, only for ONE user (and root).
BTW, if you create a similar setup on an ext3 partition, it shows the same behavior. If user B overwrites a file of user A (because he has appropriate permissions), the resulting file still has the original file stamp.
My current config allows setting the time correct time stamp on the fat partition. for root and ONE user:
As FAT lacks many of the Unix file attributes (esp. owner, group, r/w-attributes) this information is substituted when mounting a fat file system. By default user-id and group-id are 0 (root) and the r/w-attributes are derived from the current umask (usually 022). These default values can be changed by the various mount options (uid, gid, usmask, and - since 2.5.43 - dmask and fmask).
What seems to happen is this:
When copying a file to a fat partition, it gets - during its creation - the default (or defined) 'virtual' user, group ids, attributes and the current time stamp.
It seems that only the owner of a file can change its time stamp (except root, of course).
This means, if your own user id does not match the 'virtual' user-id, cp can not change the file date back to file date the source file.
The solution is clear - find out your user id (XXX), mount the partition with uid=XXX, and all the files on that partition belong to you - even the newly created ones. This way cp -a can set the original file date.
This works, of course, only for ONE user (and root).
BTW, if you create a similar setup on an ext3 partition, it shows the same behavior. If user B overwrites a file of user A (because he has appropriate permissions), the resulting file still has the original file stamp.
Thanks a lot vimico well said. I have a mounted vfat (0x0B) filesystem. For those of you who don't know how to get your uid it's in /etc/passwd the third field. I then added this line to my /etc/fstab:
Thanks a lot vimico well said. I have a mounted vfat (0x0B) filesystem. For those of you who don't know how to get your uid it's in /etc/passwd the third field. I then added this line to my /etc/fstab:
Hehe... even old answers are new for somebody (the post was nearly 3 years when you found it).
BTW, instead of your numeric ID (uid=1000) you can also use your login name (uid=mike), just as you did with group ID (gid=users).
yeah I found that out(; I've also encountered another limitation with FAT32 beyond the usual "no security", and it's making me wonder if it's worth the trouble of having something windows and Linux can share. I'll be forced to change the case on a lot of my files because of this limitation.
-Files must have mixed case for the case to be recognized (What I mean by "recognized" is case-difference visible in "ls".).
e.g. in Linux I cannot make a folder with "A" it will be recognized as "a".
blade:/windows/H/tmp # mkdir A
blade:/windows/H/tmp # l
total 48
drwxrwxr-x 3 me users 16384 Jan 14 19:13 ./
drwxrwxr-x 7 me users 16384 Jan 14 19:13 ../
drwxrwxr-x 2 me users 16384 Jan 14 19:13 a/
blade:/windows/H/tmp # mkdir a
mkdir: cannot create directory `a': File exists
blade:/windows/H/tmp # mkdir aBBc
blade:/windows/H/tmp # l
total 64
drwxrwxr-x 4 me users 16384 Jan 14 19:13 ./
drwxrwxr-x 7 me users 16384 Jan 14 19:13 ../
drwxrwxr-x 2 me users 16384 Jan 14 19:13 a/
drwxrwxr-x 2 me users 16384 Jan 14 19:13 aBBc/ <= CAN see the case difference when you have mixed case
blade:/windows/H/tmp # mkdir AbbC
mkdir: cannot create directory `AbbC': File exists <= BUT still can't create two different case folders
blade:/windows/H/tmp #
Adding numbers makes no difference 10cc is the same as 10CC, and in Linux it is seen as "10cc" no matter how you try to make it. This might be a BUG in the "mount vfat" because I think in windows "a" vs "A" is different visually (or "recognized", you still can't create an "a" and "A" in the same folder).
I've tried about every combination from "man mount" I about to try -o posix but I doubt that will give me the ability to make a dir with capital 'A'.
I tried the "mixed" option and it seems to work. I can create a directory named "A".
The original FAT only supported 8.3 filenames with no lower case. When support for longer names and mixed case were added, the 8.3 filename (short name) was still kept for compatibility reasons. (The short version of long filenames ofter contained a "~").
I presume that this option specifies how the module should handle filenames that fit into the 8.3 format and wouldn't need a long filename entry.
I tried the "mixed" option and it seems to work. I can create a directory named "A".
The original FAT only supported 8.3 filenames with no lower case. When support for longer names and mixed case were added, the 8.3 filename (short name) was still kept for compatibility reasons. (The short version of long filenames ofter contained a "~").
I presume that this option specifies how the module should handle filenames that fit into the 8.3 format and wouldn't need a long filename entry.
Thanks buddy mixed works for me too
Code:
blade:/windows/H/tmp # mkdir A
blade:/windows/H/tmp # mkdir b
blade:/windows/H/tmp # ll
total 96K
drwxrwxr-x 2 me users 16K Jan 14 19:13 aBBc
drwxrwxr-x 2 me users 16K Jan 14 19:36 Dee
drwxrwxr-x 2 me users 16K Jan 14 19:38 Qee
drwxrwxr-x 2 me users 16K Jan 14 19:38 Pee
drwxrwxr-x 2 me users 16K Jan 15 19:03 A
drwxrwxr-x 2 me users 16K Jan 15 19:03 b
blade:/windows/H/tmp # mkdir B
mkdir: cannot create directory `B': File exists
blade:/windows/H/tmp #
I'm afraid I might have been wasting your time I hear linux writes to ntfs. I knew they were working on it but I guess it's good now.
Just found another weird bug that makes me want to try ntfs. If the file's name is all numbers like ####.mp3 the permissions aren't set correctly on a rsync command. I rsync from a file with 777 (CIFS mounted) to FAT32 and the permissions are set as 745 = really weird. So now everytime I rsync that file it thinks the file is different.
Ok looked into it and writing ntfs was super-beta until recently it is just beta, and apparently a lot of people are using it. I don't have a SuSE RPM I can use but I can manually do it at these sites: http://fuse.sourceforge.net/ http://www.ntfs-3g.org/
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.