atime/ctime not working for vboxsf mounted directories

Discussions about using Linux guests in VirtualBox.
Post Reply
upgrayedd
Posts: 1
Joined: 12. Dec 2010, 21:36
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: OpenSUSE 11.2

atime/ctime not working for vboxsf mounted directories

Post by upgrayedd »

Hi all,

I have a Windows host with a linux guest; I am using the linux guest as a local web server.

If I log into the linux guest and chmod a given file, for example, I can stat the file and the ctime is updated, as would be expected.

However, if I change into a directory that is shared between windows and linux (mounted with 'mount -t vboxsf -o rw,uid=1001,gid=1000 public_html /home/user/public_html) the ctime never changes; it only changes with I modify the file, so the ctime is a duplicate of mtime.

For example:

Code: Select all

user@Virtual:~> touch testfile
user@Virtual:~> stat testfile
File: `testfile'
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: 803h/2051d      Inode: 129039      Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/ user)   Gid: (  100/   users)
Access: 2010-12-12 13:43:12.183911096 -0600
Modify: 2010-12-12 13:43:12.183911096 -0600
Change: 2010-12-12 13:43:12.183911096 -0600
A couple minutes later, I chmod the file which changes the inode data, which should update ctime; it doesn't:

Code: Select all

user@Virtual:~> chmod 000 testfile
user@Virtual:~> stat testfile
  File: `testfile'
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: 803h/2051d      Inode: 129039      Links: 1
Access: (0000/----------)  Uid: ( 1000/ user)   Gid: (  100/   users)
Access: 2010-12-12 13:43:12.183911096 -0600
Modify: 2010-12-12 13:43:12.183911096 -0600
Change: 2010-12-12 13:43:12.183911096 -0600
Now I modify the file, and ctime changes to match mtime, which is expected:

Code: Select all

user@Virtual:~> vi testfile
user@Virtual:~> stat testfile
  File: `testfile'
  Size: 11              Blocks: 8          IO Block: 4096   regular file
Device: 803h/2051d      Inode: 129039      Links: 1
Access: (0777/-rwxrwxrwx)  Uid: ( 1000/ user)   Gid: (  100/   users)
Access: 2010-12-12 13:46:45.523682050 -0600
Modify: 2010-12-12 13:46:48.549692771 -0600
Change: 2010-12-12 13:46:48.578844056 -0600
Note that if I am in any other directory on the guest, the ctime in the second example would be updated with the current time, as is normal; the ctime only stops working when I am in a shared folder mounted via vboxsf.

The same problem happens with file atime, it doesn't work for any file mounted via vboxsf.

I understand if atime/ctime are not available if the files are accessed/changed from the Windows side (atime/ctime do not exist for windows files), but I am doing everything on the linux guest, it would be nice to have atime/ctime working normally.

Well, come to think of it, this is probably a limitation shared folders in VirtualBox... can someone confirm?
mpaxtonabcd
Posts: 1
Joined: 8. Jun 2011, 14:28
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu

Re: atime/ctime not working for vboxsf mounted directories

Post by mpaxtonabcd »

I searched for ages and kept bumping into this thread, so I'll add what I found here to help others!

If you put the following in your Apache config or an .htaccess file it will fix things, for web stuff at least...

EnableMMAP off
EnableSendfile off

Cheers,
Mark
Post Reply