Unprotecting files on Mac OSX copied write-protected from Windows

Today a colleague copied a Together project from his Windows machine to my USB stick, from which I copied the files to my disk. The files were write protected on the Windows machine since the project was managed by Synergy. When I tried to remove write protection from these files I realized that the files were not read-only by standard Unix file attributes and I could not use chmod to write-enable the files. When opening the properties dialog on those files one could see that the flag “Geschützt” (Protected) is set. Since the project consists of some hundred files using the dialog to remove this flag is no option.

After some searching I found this article which explains that OS X has some additional flags that supersede the standard UNIX permissions. These additional flags can be listed with ls by adding the -O option:

ls -AlO
total 152
-rw-r--r--@  1 thoms  thoms  hidden  6148 17 Mai 17:56 .DS_Store
-rwxrwxrwx   1 thoms  thoms  -        312  7 Mai  2009 .checkstyle
-rwxrwxrwx   1 thoms  thoms  -        234  5 Jun  2009 .designRoot
-rwxrwxrwx   1 thoms  thoms  -      48559  6 Mai  2009 .pmd
-rwxrwxrwx   1 thoms  thoms  -        922 21 Okt  2009 .project
drwxrwxrwx   6 thoms  thoms  uchg     204 17 Mai 17:52 Dokumente
drwxrwxrwx  11 thoms  thoms  uchg     374 17 Mai 17:52 Model Folder
-rwxrwxrwx   1 thoms  thoms  uchg      71  7 Mai 10:36 _ccmwaid.inf
-rwxrwxrwx   1 thoms  thoms  uchg    1583 23 Jul  2008 grafiken.tpl

The flags can be read and manipulated with the chflags command. For unsetting the “user immutability flag” on a complete directory execute

chflags -R nouchg *

Advertisements

First experience with SSD in MacBook Pro

The weakest link in the hardware chain of a notebook is always the harddisk. What do you really have from dual core processors and gigabytes of RAM when most of the time you have to wait for I/O? Over the time my notebook got steadily slower and the harddisk was running and running. I tried cleaning up the harddisk and followed several advises, all with just small success. It must be remembered that I’m primarily working on Java software development with Eclipse, where it is natural that you have thousands of small files to load and to write. These files cannot be read in one flow, and handling lots of small files is much slower than handling larger files. Now the notebook got so slow that I was really badly annoyed and finally decided to ask our admin whether I could get a SSD for my Mac. I hoped this will reduce the performance bottleneck and help me work more efficient again.

Today our supplier got this disc and I immediately went to them to exchange the disk. Just made a backup and some benchmarks before the change. Now I have all working again and getting my first impressions. What I just can say is: Go get an SSD! The difference is amazing!

Facts

Technical Details

  • MacBook Pro (2007 Series)
  • 2.33 GHz Intel Core 2 Duo
  • 4 GB 667 MHz DDR2 SDRAM
  • Mac OS X 10.5.8

Old Disk:

  • Hitachi HTS5416116J9SA00, SATA
  • 5400 RPM
  • 160 GB
  • Apple HDD Firmware 2006
  • Manufactured JAN-07

New Disk:

  • Corsair CMFSSD-128GBG2D
  • 128 GB

Benchmark with AJA System Test

Write Performance: 32.6 -> 87.6 MB/s   ( x 2.68 )
Read Performance: 38.5 -> 126.4 MB/s   ( x 3.28 )

Benchmark with Xbench

Disk Test Hitachi SATA 5400 RPM 160GB Corsair SSD 128 GB Factor
Sequential Uncached Write 4K blocks 29.69 MB/sec 50.76 MB/sec 1.71
Uncached Write 256K blocks 37.20 MB/sec 88.88 MB/sec 2.39
Uncached Read 4K blocks 18.13 MB/sec 21.83 MB/sec 1.20
Uncached Read 256K blocks 38.30 MB/sec 99.32 MB/sec 2.59
Random Uncached Write 4K blocks 1.05 MB/sec 11.29 MB/sec 10.75
Uncached Write 256K blocks 20.48 MB/sec 30.76 MB/sec 1.50
Uncached Read 4K blocks 0.47 MB/sec 12.54 MB/sec 26.68
Uncached Read 256K blocks 17.24 MB/sec 66.08 MB/sec 3.83

The complete results can be downloaded and viewed with Xbench: Before After.

Conclusion

The benchmarks clearly show that I/O has boosted performance by factors. Really extraordinary is the comparison of writing (10x) and reading (26x) randomly small files, which comes close to the behavior that you have when working with Eclipse and larger projects. But even in other categories it is clear that the SSD beats the old HD clearly.

What the benchmarks already show I can share with my subjective feeling when working with the new hardware. It is now as if I would have a completely other system. Startup of the system and applications is now really fast. To give you an imagination: Open Office (yes, I use it from time to time, don’t sent me comments on that!) starts now up in 2 seconds! I did not measure it before, but guess it would be about 10-15 seconds before. iTunes takes less than 2 seconds to start. And Eclipse starts up I would say about 4 times faster.

When I think about how many time got lost for me just for waiting for I/O before… And finally it prolonged the time that I will use my MacBook, since now again I don’t have the feeling that I need to upgrade to a newer generation. Otherwise I think this year I would have asked itemis to buy a new one.

In a few years I think most notebooks will have SSDs. Besides they are much faster they also consume less energy and thus don’t heat up the notebook that much, are more robust, and are silent. It’s just that SSDs are rather expensive now and have a limited lifetime. Anyway, I believe that the SSD is its investment really worth!

MacBook slowdown through corrupt file permissions

I was suffering from a massive slowdown of my MacBook Pro. This was really annoying, and I could not figure out what caused the trouble. If you read the posts on the net most of them recommend to buy more ram, close processes or make more space available on the HD. Now, this did not help really. I have > 20GB free on the disc, 4 GB of RAM, and only necessary programs running. So, this cannot be the reason.

Two hints really helped me:

  1. Spotlight. I reduced the scope of the index heavily by adding Privacy folders in the Spotlight settings.
  2. Repair file permissions. This forum thread really saved my day. User k8t recommends to fix the file permissions.

Have you repaired permissions?
HD > Apps > Utilities > Disk Utility, then select the drive and click Repair Permissions.
Do this after installing programs, for sure!

I have done that, and the Disk Utility found some corrupt permissions. Now the experience is really better.

Finding / deleting old files

I just wanted to clean up my Maven repository a bit and remove some old artifacts. This is unproblematic since all missing artifacts would be fetched again. But then the question arised: How can I find files that are older then a specific date? Unfortunately the Finder does not have an appropriate search function, nor Spotlight helps. Yes, there is the find command, but it only has a -newer option, no -older.

In my search I found this forum post, which gave me the solution. The solution is to create a temporary file with the touch command and give it the timestamp you want to compare with. Then use the find command and invert the query with “!”.

Let’s say we want to find all files older then 2008-01-01 from the current directoy “./” and below. The result will be stored in a temp file that is used as input for the tar command to archive the old files. The result can be queried like this:

touch -t 200801010000 /tmp/touchfile
find ./ ! -newer /tmp/touchfile > /tmp/filelist
tar --create --gzip --files-from /tmp/filelist --file repository-before-2008.tar.gz
rm /tmp/touchfile
rm /tmp/filelist

Maybe you want to use a date relative to the current date instead of a fixed date. This can be achieved by evaluating the date command in combination with touch. For an example, to modify the timestamp file’s modification date 6 months back, use

touch -t $(date -v -6m "+%Y%m%d%H%M") /tmp/filelist

With the zip command the older files can be archived in one command:

zip -rttq 2008-01-01 repository-before-2008 ./

In my case the tar (and also tar.gz) archive was by far larger then the zip archive. I did not investigate the reason further yet.

After creating the backup zip I used the find command again to delete the old files from the repository.

find ./ ! -newer /tmp/touchfile -delete

Upgrading OSX subversion client

Running SVN from my command line for a project I originally checked out with Eclipse gave me the message

“svn: This client is too old to work with working copy ‘.’; please get a newer Subversion client”

My subversion version was 1.4.4:
> svn --version
svn, version 1.4.4 (r25188)
compiled Jun 23 2007, 08:53:30
So I downloaded the “Universal Subversion 1.6.3 Binaries for MAC OS X (32 and 64 bit)” package from CollabNet.
By default this package installs subversion to /opt/subversion. So still my old subversion installation was 1.4.4
> which svn
/usr/local/bin/svn
I edited then ~/.profile and set /opt/subversion/bin in front of my PATH:
export PATH=/opt/subversion/bin:/usr/local/bin:/opt/local/bin:/opt/local/sbin:$PATH
And finally subversion now is used in the right version:
>svn --version
svn, version 1.6.3 (r38063)
compiled Jun 23 2009, 16:38:16

Posted via email from Karsten’s Blog

MacBook Pro battery defect

After exact 2 years the battery of my MacBook Pro 17” is now defect. First indication was when I worked with Heiko Behrens two weeks ago in the evening at Hotel West in Frankfurt. We had only one power cable in the room and shared one. I was working on battery and without warning the Mac switched off. This behavior repeated unpredictable later again. Next symptom was that the Mac clicked at random times at the cursor position without interaction. I twittered this and got feedback from a colleague that there is a known problem with MacBook batteries that lead to this clicking error. He asked me if the battery has a bump. Some batteries get a bump which presses from below against some electronic interior, causing failures until total defect. At this point of time almost nothing was visible, but in the meanwhile the battery has a massive bump.

DSC00004

Unfortunately there is no guarantee on this battery. itemis already ordered a new one and I will pick it up when driving to itemis this weekend.