X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Message-ID: <47FADE53.1DFBEE53@dessent.net> Date: Mon, 07 Apr 2008 19:54:11 -0700 From: Brian Dessent X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: A FAQ regarding defrag and permissions of nonadmin files? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Gmane User wrote: > The defragger I used was JkDefrag. And there was the explanation, right in the > online documentation. The files to be defragged need to be accessible by admin. > I never suspected that something as system-wide as defragging would be > dependent on a specific account. Setting all files to go+rwx allows all the > files to defrag. > > This arrangement clashes directly with the unix practice of having all nonadmin > user file permissions default to u+rw,go-rwx. A unix user (not necessarily an > admin, as I've never been) who wanders into the weird and wonderful world of > Windows would think he/she found salvation in cygwin (and would mostly be > right). He/she (let's just say "It") would innocently and obliviously bring its > Unix ways with it, and never be able to defrag. I am baffled by why this caveat > isn't documented in any defrag or cygwin posting/page that I've come across. This is just patently false. While it may be true that a defrag program that runs in userspace needs access to a file to defrag it, that does not in any mean that some special "admin" user needs access to it. And besides, most defraggers install as a service anyway, so they run as the system. $ touch file $ chmod 600 file $ getfacl file # file: file # owner: brian # group: None user::rw- group::--- mask:rwx other:--- $ perl -e 'print "a"x10240' >>file $ perl -e 'print "b"x10240' >>file $ contig -a file Contig v1.53 - Makes files contiguous Copyright (C) 1998-2006 Mark Russinovich Sysinternals - www.sysinternals.com c:\tmp\file is in 2 fragments Summary: Number of files processed : 1 Average fragmentation : 2 frags/file $ contig file Contig v1.53 - Makes files contiguous Copyright (C) 1998-2006 Mark Russinovich Sysinternals - www.sysinternals.com Processing c:\tmp\file... Summary: Number of files processed : 1 Number of files defragmented: 1 Average fragmentation before: 2 frags/file Average fragmentation after : 1 frags/file The file has been defragmented and there was no need for any chmod go+rwx. For the record I took a look at JkDefrag's source at some point in the past and it made me shudder how badly coded it was. I suggest UltraDefrag which is open source and free and it installs a native driver to do the defragmentation so there is none of this worrying about who owns a file or what ACLs it has. Since it has a native interface it can even run at bootup before files such as pagefile.sys are locked. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/