Archive

Posts Tagged ‘apple’

nerd-stuff

July 3rd, 2011 1 comment
Categories: fun, hardware Tags: , ,

Cluster with Apple TV Boxes

March 25th, 2011 19 comments

Yesterday I talked to a colleague from Munich, and he told me about one of his research projects http://appletvcluster.com/

This could be interesting for everyone, who wants a cheap/small cluster to play with, especially our LCTP group.

Categories: linux, nerdcore Tags: , ,

MacBook Pro SSD tuning

January 21st, 2011 4 comments

As I only use my mac for work/programming/something stuff I chose a SSD (128GB) as storage and upgraded just yesterday from 4 to 8GB of RAM. The following is list of steps I made to maximize IO capabilities and to minimize the SSD usage to prolong its lifetime.

Hint: if something should fail, rebooting into single user mode always works (press command+s during boot). There you can simply rename the RamFS script described below to switch off all changes i describe in the following . . .

noatime

Its common knowledge in linux userland that noatime helps to reduce IO as per default on each access of a file the last-access-timestamp has to be renewed. So each read on a file creates a write – noatime (no access time) prevents the write.

Activating that for the disks is done by adding a launchdaemon-script named:

/Library/LaunchDaemons/gpl.selfmade.noatime.plist

< ?xml version="1.0" encoding="UTF-8"?>
< !DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
        "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>Label</key>
        <string>gpl.selfmade.noatime</string>
        <key>ProgramArguments</key>
        <array>
            <string>mount</string>
            <string>-vuwo</string>
            <string>noatime</string>
            <string>/</string>
        </array>
        <key>RunAtLoad</key>
        <true />
    </dict>
</plist>

Just to be sure:

sudo chown root:wheel /Library/LaunchDaemons/gpl.selfmade.noatime.plist

After rebooting a “mount” should show that the additional noatime-flag is now active.

RamFS

The most useful thing to me having 8GB of RAM is working on a RamFS and thus having low latency while developing/compiling (using a local GIT to not loose work on power outage is crucial here). This is what has to be done:

Create a Folder and a file both named RamFS and set access rights accordingly

cd /System/Library/StartupItems
mkdir RamFS
sudo chown -R root:wheel RamFS
sudo chmod -R u+rwX,g+rX,o+rX RamFS
cd RamFS
touch RamFS
sudo chmod u+x,g+x,o+x RamFS

This is my actual version of the RamFS script:

#!/bin/sh
# Create a RAM disk with same perms as mountpoint
 
RAMDisk() {
    mntpt=$1
    rdsize=$(($2*1024*1024/512))
    echo "Creating RamFS for $mntpt of size $rdsize 512byte blocks"
    # Create the RAM disk.
    #dev=`hdik -drivekey system-image=yes -nomount ram://$rdsize`
    dev=`hdid -nomount ram://${rdsize}`
    # Successfull creation...
    if [ $? -eq 0 ] ; then
        # Create HFS on the RAM volume.
        newfs_hfs $dev
        # Store permissions from old mount point.
        eval `/usr/bin/stat -s $mntpt`
        # Mount the RAM disk to the target mount point.
        mount -t hfs -o union -o nobrowse $dev $mntpt
        # Restore permissions like they were on old volume.
        chown $st_uid:$st_gid $mntpt
        chmod $st_mode $mntpt
    fi
}
 
# Test for arguments.
if [ -z $1 ]; then
    echo "Usage: $0 [start|stop|restart] "
    exit 1
fi
 
# Source the common setup functions for startup scripts
test -r /etc/rc.common || exit 1 
. /etc/rc.common
 
StartService () {
    ConsoleMessage "Starting RamFS disks..."
    RAMDisk /private/tmp 4096
#    RAMDisk /var/run 64
#    RAMDisk /var/db 1024
#    mkdir -m 1777 /var/db/mds
}
StopService () {
    ConsoleMessage "Stopping RamFS disks, nothing will be done here…"
    # diskutil unmount /private/tmp /private/var/run
    # diskutil unmount /private/var/run
}
 
RestartService () {
    ConsoleMessage "Restarting RamFS disks, nothing will be done here..."
}
 
RunService "$1"

We also need a plist-file called “StartupParameters.plist” in that very folder:

< ?xml version="1.0" encoding="UTF-8"?>
< !DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
    <dict>
        <key>Description</key>
        <string>RamFS Disks Manager</string>
        <key>OrderPreference</key>
        <string>Early</string>
        <key>Provides</key>
        <array>
                <string>RamFS</string>
        </array>
        <key>Uses</key>
        <array>
                <string>Disks</string>
        </array>
    </dict>
</plist>

If you want to use less than 2GB for the ramdisk please switch the dev line to hdik which is the much more lightweight way of mount the ramfs – i want to have a 3-4GB ramdisk which is something hdik cant do do i reverted back to the old hdid.

The flag nobrowse of mount makes sure i dont see the mountpoint in finder and on the desktop while union merges files already in the folder when the ramdisk is created (for deamons that created pidfiles etc earlier in the boot process)

I have a folder called Software in my home were i keep all my (software)projects. The tmp-folder there actually links to the ramdisk at /private/tmp via a softlink. I use that tmp for buildfiles, caching and so on.

If you use macports (as i do) it might also be a good idea to replace
/opt/local/var/macports/build
and
/opt/local/var/macports/distfiles
with softlinks to /private/tmp. Keep in mind that your ramdisk must be sufficient to hold the tar.gz, the unpacked sources as well as all the buildfiles for this to work. As an example, the gcc4.4.5 uses around 2.9GB . . .

I also think about moving ~/Library/Caches to the ramdisk, maybe creating an own ramdisk for that purpose.

If you have more ideas let me know in the comments . . .

Categories: software Tags: , ,

iPad Flash

January 31st, 2010 1 comment

Ich muss mal schamlos von fefe abschreiben.  Aber die Unterhaltung fürs Wochenende die er da vorschlägt ist wirklich vortrefflich. Nur damit die nicht-fefe-Leser nichts verpassen.

Flash is the single worst piece of technology on the web. Hopefully the iPad will be another nail in its coffin.

Categories: nerdcore Tags: , , , ,

Chip

February 25th, 2009 1 comment

Wie jetzt?!?cpu_gleich_speicherAus dem Apple Campus Store.

Categories: fun Tags: , , ,