change file creation time on msdosfs

Dan Nelson dnelson at allantgroup.com
Sat Aug 28 04:08:23 UTC 2010


In the last episode (Aug 27), Robert Bonomi said:
> > From owner-freebsd-questions at freebsd.org  Thu Aug 26 14:33:04 2010
> > Date: Thu, 26 Aug 2010 21:06:04 +0200
> > From: Dominic Fandrey <kamikaze at bsdforen.de>
> > To: freebsd-questions at freebsd.org
> > Subject: change file creation time on msdosfs
> >
> > I need to change the file creation time of some files on an msdosfs file
> > system.
> >
> > Is there any other way to do this than copying the file and deleting the
> > original?
> 
> There are _always_ alternative ways.  With suffficient knowledge, oue
> could, for example, use 'dd' to copy the required two bytes to the
> appropriate position on the raw device holding the filesystem.  This
> approach is, however, not likely to be at all 'reasonable' for the average
> user.
> 
> >               The usual suspects like touch and mv do not work.
> 
> yup.  'creation' timestamp is intended to be more-or-less immutable in the
> Unix world.  And that 'viewpoint' carries over to other kinds of
> filesysems grafted onto a Unix host.

No; the utimes() syscall can be used to easily set the creation time (called
birth time so it doesn't get confused with the "ctime" file metadata change
time).  More likely is that whoever added birthtime to ufs didn't bother
updating the msdosfs code.  If one of the other BSD's has implemented it, it
should be relatively easy to import the changes.  Otherwise you'll probably
have to look at how birthtime is currently handled in ufs, and make it work
in msdosfs.

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list