Showing posts with label mac os x. Show all posts
Showing posts with label mac os x. Show all posts

Wednesday, 12 October 2011

How To Disable Time Machine Local Backups (and Relinquish Space in the MobileBackups Folder)

This morning, after importing a bunch of RAW files from my Nikon camera, I was startled (once more) by the lack of responsiveness of my MacBook Pro running OS X Lion.

Since the update, in fact, I'm growing pretty disappointed with Lion. It never roared just like the good ole Snow Leopard. The Lion cub has only shyly purred and whined, so far.

One of the things that bothers me most is Spotlight performance. Assuming you noticed it, have you ever wondered what the mdworker process is doing when it jeopardizes your Mac resources? I have: staring impotently at the screen, listening to the spinning rust crackling, powerlessly witnessing how the operating system is waiting to complete who-knows-what.

This morning, I opened Lightroom, started importing some RAW files, and started working on them. Well, trying to work on them while Lion was performing its... "housekeeping".

Frustrated, I expressed my anger on Google+. A friend of mine, Joaquin, pointed out both the cause and a workaround of the new Lion's behaviour.

It turns out that Lion is performing periodic local backups that will be flushed upon your time machine disk when connected. Thinking about versions, aren't you? Anyway, that's also why the new /.MobileBackups folder into your OS X hard disk is eating up disk space. Never noticed purple and white snapshot lines in Lion's Time Machine user interface? White ones are local backups, purple ones are "regular"time machine backups on an external disk. Well, local backups are kept for 8 days and they'll be taken only if you've got enough space on your disk. However, if you, like me, manage huge quantities of big files (such as a camera RAW files), this feature can start eating up an enormous amount of space.

If you, like me, feel like turning off this amazing feature you can use the following command:

$ sudo tmutil disablelocal

Should you change your mind about it, you can always turn it on again using:

$ sudo tmutil enablelocal

These are just the kind of options that should be accessible in the user interface.

Hope this helps you.

Wednesday, 7 September 2011

Multiple Icons of the Same Application in Launchpad

One of the new features introduced by OS X Lion is the Launchpad. The launchpad gives you access to the installed applications in your Mac from a window that is reminiscent of iOS devices. In fact, it superimposes on your current desktop window, with a fancy blur effect, and a list of application icons is presented in a rectangular grid. You can even make folder in it by dragging an icon over one other. It seems an iPhone screen on steroids.

In my humble opinion, it's awful.

Anyway, one day, using a wrong gesture, the Launchpad screen was launched and I noticed that the Skype icon was presented twice. Strange, thought I. I tried to remove one of them, but they could not be deleted. I tried dragging one into the trash. It didn't work. To make the story short, I did not lose time investigating this weird Launchpad behavior: it's the kind of window I prefer not to see at all.

Some weeks after Skype informs me that an update is available: I accept to install it immediately and wait for the installer to finish. Curiosity killed the cat: I opened the Launchpad and guess what? Another brand-new Skype icon had just been added to the long row of Skype icons already present in the Launchpad window.

A quick glance confirmed what I already knew: there was just one Skype application installed in my Mac and no other link to it was present whatsoever that might have gotten Launchpad confused. I completely removed Skype from the system and reinstalled it from scratch. No way.

It was just time to act and stop the uncontrollable icon proliferation. Since every user can customize Launchpad, I thought that a good place to start was the ~/Library folder. I grep-ped every file into it looking for the "Skype" string (the icon title in the Launchpad) and a file caught my attention:

~/Library/Application Support/Dock/FABCDB4F-FBDE-42E4-A14F-80FA7476989C.db

An SQLite 3 database file (as confirmed by the file command)! It looks like the potential offender, doesn't it? I then backed up the file, removed it, logged out and logged in again. I started the Launchpad and bingo! Launchpad had just regenerated the database file and now only one Skype icon was shown in the Launchpad window.

As I said, I'm not going to use again. But at least I can rest assured that icons are gone away. Hope this can help you guys if you run into similar troubles with Launchpad.

Sunday, 25 July 2010

An @ Symbol in OS X File Permissions and the Problems That Came

Today I was deploying some software updates in our Solaris 10 servers and, since such updates are distributed in files archived with the GNU tar utility (not shipped by default in Solaris 10), I had to convert them before moving them to our servers. I'm quite accustomed to such a procedure: that's why (amongst other more important reasons) I always have an OpenSolaris virtual machine running in my other desktops (thanks to VirtualBox).

Today, notwithstanding the fact the I had a gut feeling that I was not doing the correct thing, I decided to open a Mac OS X terminal and do the job from there. GNU tar and pax are there, aren't they? There should not be any problem, thought I.

Well, I should have paid attention to that gut feeling of mine: to spare the required OpenSolaris boot, I lost much more than what I had planned. I learned something new but... what was it worth? A bunch of non portable behaviours of Mac OS X? Just the confirmation I needed, once again (I realize I'm a stubborn fellow): if you can, do not rely on a Mac to do your UNIX-ish tasks. Chances are you're going to waste more than you believed.

This is what happened.

Making a pax File for a Solaris Host

This was meant to be a quick task. I copied the archive from a Solaris NFS mount where, some days ago, I had stored the file. I ran gunzip to decompress the file, ran tar to unpack the files, ran pax to store the resulting directory in a pax file and used rsync to quickly transfer the resulting archive back to the target Solaris machine:

$ gunzip [file.tar.gz]
$ tar xf [file.tar]
$ pax -w -f ./[file.pax] [dir]
$ rsync -vz --inline [file.pax] [myserver]

I then connected to the target server and used pax to explode the transferred archive. Since one of the things I feared was Mac OS X messing around with file permissions, I quickly checked the results on the Solaris side and everything looked fine. Well, sort of...

The next thing I usually do with such bundles is checking the differences between the running version and the soon-to-be-deployed one to be sure I won't miss any customization I made in the instance to be patched. It usually is another easy job since very few XML files are usually involved. Great was my surprise when diff began to write out hundreds of differences between one version and another.

Doh! It seemed as though somewhere in between somebody had decided to duplicate each file following a naming pattern; if the expected file was named x, I was seeing two files in Solaris: x and ._x. Where did these file came out from?

Back to the Mac

The original directory had been deleted just after producing the pax file so that the first I did was using pax to unpack the archive in the Mac. As I told you, everything looked fine. Except for an @ character that should not be there:

drwxr-xr-x@ [...snip...]

Maybe you don't know about it but that means that such a file has extended attributes set. Extended attributes are basically metadata: the file system does not interpret them and the ls command uses the @ symbol after the file permissions to inform you that they are there.

Strange Things Are Happening

There's nothing strange about extended attributes: it's very important to be aware of their existence to correctly handle them when, for example, you need to do a backup or move files from one file system to another (unless you don't mind losing them.) Solaris' pax and tar, for example, both support archival of extended attributes even if, by default, they ignore them. Since I know that my original archive had no extended attribute set in any of its file, I just ran a plain pax to build my archive. Maybe OS X pax defaults to a different behaviour so that I checked pax man page.

Doh! Oddly, OS X pax man page makes no mention at all of extended attributes, notwithstanding the fact that, undoubtedly, it was in fact managing some. Which? In OS X, just run xattr -l to find out.

Quarantine

A xattr told me that the com.apple.quarantine extended attribute was set in the culprit and a quick script confirmed that every file in that directory had that attribute set. According to Apple's documentation, that attribute is set by recent versions of OS X to mark the file as a potential threat. Do you remember when finder kindly asks you if you're really sure you want to open a downloaded file? The quarantine extended attribute is the mechanism OS X programs use to store that information.

How did it make it there?

But wait! I downloaded a tar.gz file and stored in an NFS 4 mounted file system for later processing. The question is:
  • How did that attribute was stored in the NFS 4 file system where I stored the file?
  • How did that attribute make it into every file stored into the pax archive?

As far as it concerns the first question, NFS 4 does support extended attributes. But again, should it be there, I would have known because I checked it directly in the Solaris host and, moreover, the box that acts as a NFS server runs some cron scripts that checks (and fixes to my taste) ACLs and extended attributes in some of the exported NFS file systems. It was very easy to find out that OS X, when storing such a file in a remote NFS share, instead of using NFS 4 extended attributes it stores them in a separate file named with the pattern mentioned above. I then discovered that the shared NFS file system in question is plagued by ._* files. Everywhere.

As far as it concerns the second question, well... I copied once again the file using the finder and performed the same operations I did before. The resulting files all had the quarantine extended attribute set. Who's the culprit, I do not know. I don't even care. The fact is that OS X is performing this operation with tools such as pax and tar without informing the user and, what's even worse, without even mentioning it in such commands' man pages.

Conclusion

The reasoning above explains why, even if Solaris pax (such as NFS) aren't managing any extended attribute, I did end up with duplicated files which were inserted into the pax file produced with Mac OS X. Probably they aren't going to hurt my deployment but surely they should not be there.

For the sake of curiosity, I checked that removing the ._* files in the NFS share made everything go back to normal.

Nevertheless, since I feel there are many OS X dark corners left for me to discover, I won't be making such an error again. Instead of waiting a couple of minutes for a virtual machine to bootstrap, I ended up wasting an entire hour for a (yet another...) bad documented and non-portable idiosyncrasy of an operating system that brings no added value with it.

Tuesday, 18 May 2010

VirtualBox v. 3.2.0 Has Been Released Adding Support For Mac OS X


Today, Oracle Corporation has released VirtualBox v. 3.2.0 and renamed it Oracle VM VirtualBox.

This is a major version which includes many new technologies such as:
  • In-hypervisor networking.
  • Remote Video Acceleration.
  • Page Fusion.
  • Memory Ballooning.
  • Virtual SAS Controller.
  • Mac OS X guest support (on Apple hardware only.)

And much more. If your want to read the official announcement please follow this link. If you want to read the change log please follow this link.

Sunday, 11 April 2010

GlobalSAN iSCSI initiator for Mac OS/X v. 4 has been released

As I told you in another blog post, I'm using GlobalSAN iSCSI initiator for Mac OS/X to remotely connect to my time machine disk, which happens to be a ZFS volume managed by a Solaris host. Studio Network Solutions has just released GlobalSAN version 4: alongside some UI enhancements, this new version of the GlobalSAN software takes advantage of Snow Leopard characteristics. A screenshot of the new GlobalSAN UI is the following:


A word of warning: if you're using an older version of GlobalSAN (such as version 3), in order to successfully install this new version you've got to completely remove the older software by using the uninstaller which comes with the older package. If you no longer have it, please download it once more, uninstall it and then install the new version.


Sunday, 7 March 2010

Is Safari leaking memory?

I was working at some Java EE application with my MacBook while I realized that I was running out of memory. Strange, isn't it? I was just running the following:

Not so much for a MacBook equipped with a 4GB of RAM to experience a memory shortage. When I opened the Activity Monitor I was shocked to discover that my MacBook experience was jeopardized by the Safari web browser.

Since then, I'm monitoring Safari resource consumption. I've also been searching for information about Safari leaks and it seems that since a long time there are "outstanding" memory leaks which, apparently, haven't been corrected so far.

After using Safari some time that's what I see:


Although I'm reasonably happy with Safari speed, almost one gigabyte is simply too much for some newspaper reading and a maximum of a couple of tabs open. I'm seriously thinking about switching to Google Chrome.


Apple Mac OS X' "Safe Sleep"

Safe sleep is no new kid on the block: at least as far as it concerns major operating systems such as Microsoft Windows, GNU/Linux or even Sun Microsystems' Solaris: never heard about Windows' hibernation or Solaris suspend and resume? I bet you have.

Apple has christened this functionality as "Safe Sleep" in its flagship OS, Mac OS/X. What's most "astonishing" about "Safe Sleep" is that you're not going to find any reference to it in your Finder menu or even in your System Preferences panes. You'll only find references to a "generic" sleep function.

Safe Sleep

During safe sleep the system will persist to disk all of the machine state (such as RAM's) so that it could be restored in the case all of the power is lost, for example during battery replacement. Under normal conditions, you'll hardly notice a resume from disk since the laptop battery power will maintain data on RAM even when the battery power has run real low. That's why during battery calibration Apple suggests to let the laptop sleep at least 5 hours. The next time you calibrate your battery, you should notice a slightly different boot screen when your laptop wakes up and reads its state from disk.

How to force a safe sleep?

Despite other implementations of a similar technology, Mac OS/X does not provide a way to force a system hibernation simply because every time your computer goes to sleep, it will persist its state to disk. This way you can let your battery discharge without worrying about your data. You could remove it, too. Next boot, it would simply read state from disk and restore it.

That's counterintuitive for who's accustomed to other OS where such a process should be explicitly triggered by the user. When using an Apple laptop, simply don't worry. You'll quickly get used to never, or very rarely, shutting down your system.

Handling your laptop while sleeping

When your laptop is sleeping, most of the hardware components will be completely off. That's the case of the hard disk: if you're laptop is equipped with a good old rotating hard drives, as soon as the computer state has been persisted, the disks will be switched off. The only evidence about this is the white led in front of your laptop: it will switch from a solid on state to a blinking state when the drives have been switched off.

Until complete disk shutdown, handle your laptop with care.

Once the laptop is sleeping, you can safely handle it as if it had been completely shut down. The real difference between a sleeping and a shut down laptop is RAM electrical state. As far as it concerns mechanical parts, there will be no difference at all. Hence:

No need to worry about hard disk heads landing on the platters. Put your sleeping laptop into your bag and safely transport it.

No need to emphasize the obvious, but I noticed a bit of misinformation about how safe sleep works and about the dos and don'ts. Indeed, safe sleep is the best way to forget about quit all applications and shut down. Reboots won't ever be faster.



Wednesday, 17 February 2010

Mac OS X as an iSCSI initiator: Time Machine on ZFS

As I described in previous posts, I setup an iSCSI target with Solaris COMSTAR backed by a ZFS volume. I want to use this volume as a disk for Mac OS X Time Machine. This way, I'll get the best of the two technologies: a pretty looking and easy to manage Time Machine for backing up my MacBook backed by an enterprise-level, redundant and scalable ZFS volume published as an iSCSI target over my private LAN.

No more consumer disks on a table, no more poor hardware-implemented file system sharing protocol. No more worries to lose a disk. Just Solaris, ZFS, COMSTAR and a LAN.

Mac OS X as an iSCSI initiator

Although it's a subject most spoken of, Apple hasn't released yet the necessary components for Mac OS X to be an iSCSI initiator. Fortunately there exists a solid and free solution by Studio Network Solutions: globalSAN iSCSI Initiator for OS X. Just download it, install it, restart your OS X and a new panel will appear in your System Settings:


Connecting to a target

Connecting to a target is really easy: just use the globalSAN iSCSI GUI to add the target:


The target name is obviously retrieved from your target configuration.

Using the disk

If you read the previous post, you'll know that this target is backed by a ZFS volume which must be formatted before being used. With the Disk Utility you can format the new disk:



Using the disk with the Time Machine

To use the new disk with the Time Machine you just follow the usual procedure:


Conclusion

That's it. Using a ZFS volume as a disk for Mac OS X Time Machine is just a few clicks away. Next time you plan to buy a new external hard disk, just wait and take into account that a robust enterprise-level solution is available with not much more than the necessary budget to purchase a couple of consumer disks.

Using ZFS with Apple's Time Machine

The many of us who got accustomed to the ZFS wonders won't willingly trade ZFS for another file system, ever. But even though many ZFS users are running Solaris on their machines, including laptops, as I am, there are cases in which running another OS is desirable: that's when I seek the best option to integrate the other systems I'm running with Solaris and ZFS.

In the simplest case using some file system protocol such as NSF or CIFS is sufficient (and desirable): that's how I share the ZFS file systems where I archive my photos, my video, my music and so on. Sharing such file systems with another UNIX, Windows or Mac OS/X (just to cite some), it's just some commands away.

In other occasions accessing a file system is not sufficient: that's the case with Apple's Time Machine, which is expecting a whole disk for its own sake connected locally.

Fortunately, integrating ZFS and Time Machine is pretty easy if you're running a COMSTAR-enabled Solaris. Although setting up COMSTAR is a very well documented topic by the Solaris and OpenSolaris documentation, I'll give you a walk through the necessary steps to get the job done and having your time machine making its backup on a ZFS volume. You'll end up with the benefits of both world: a multidimensional time machine which will take advantage of ZFS snapshotting and cloning capabilities.

The steps I'll detail in the following posts are:

With such a solution, you will need no USB/FireWire/anything-else drive hanging around. You won't need to rely on consumer drives which implement some kind of file system sharing protocol which, as explained earlier, won't fit into the time machine use case.

Just a network connection and a box to install Solaris, ZFS and COMSTAR, and you'll provide a scalable, enterprise-level, easy to maintain solution for your storage needs.

Saturday, 24 October 2009

Apple Discontinues Mac OS/X ZFS Project

One of the reasons I really love Solaris 10 (and OpenSolaris) is ZFS. I'm also running Solaris at home because of ZFS. I'd also thought about buying an Apple machine some day or the other but was waiting about ZFS being integrated into Mac OS/X. Well, it seems that the game is over:


Apple has posted a note on its ZFS project web page informing the users that the project is being discontinued. Apparently, there's a ZFS MacOS refugee camp (in their own words) on Google Groups.

I'm really sorry about that. ZFS is a great technology and it would have fitted very well on Mac OS/X, although it's (mainly) a consumer oriented Operating System. I was wondering about a ZFS-enabled Time Machine (sort of OpenSolaris Time Slider). Real cool, but it'll never be: rumors suggest that it was a political, rather than technical choice.

Nonetheless I think Mac lovers have lost the opportunity of running ZFS as their file system. As far as it concerns myself, a real argument about switching (at least the laptop) has just faded away and I think I'll keep on sticking with Sun Desktops and with some compatible laptop here at home.




Tuesday, 21 July 2009

Desktop archeology: Sun Project Looking Glass. Doesn't it look like Mac OS/X Leopard?

If you have a look at Apple's Cocoa API you'll notice that many functions and data structures start with the NS prefix. If you're wondering, that prefix comes from the NeXT/Sun Microsystems partnership during the development of OPENSTEP.

What struck me most this morning, since I'm not such an Apple follower, was how deep is the resemblance between Sun Project Looking Glass desktop and the Aqua improvements introduced by Apple in the Leopard (10.5) release of its Mac OS/X.

Back on 2003, I still was an Analyst at Accenture, developing a B2B application on the J2EE platform, when I stumbled upon an article describing Sun Microsystems' Project Looking Glass. I was a Solaris 9 user, then, still used to the CDE desktop. Sun was beginning to distribute a customized GNOME desktop for Solaris, what would become the Java Desktop System, but then it was the exception, not the norm. I remember commenting about Looking Glass with my colleagues, in particular with Luca Raggi. It seemed them such a bad idea: why would somebody want such thing on Solaris? At the end, that phrase probably sums up what happened: nobody used it. There was development hype but we all know what came next: the Sun Java Desktop System and as far as it concerns 3D effects, Compiz. That is, a GNOME distribution tailored for Solaris.

Probably it was the best thing it could happen: Solaris distributing GNOME instead of a proprietary desktop environment is just better for us, the users. Would you have thought about running so complete a GNOME desktop on Solaris, back then? I wouldn't and I'm glad it happened. (Well, I'd rather run KDE, given the choice, but that's another story).

Years have passed and I had forgotten about Looking Glass until yesterday, when I started to look at Apple's API. Cocoa history came back into my mind and I felt like I had to search for Looking Glass screenshot. I'd got a CD, but who knows where it is. So here they are:

Doesn't it remind you something? Maybe this:

There are 3 years in between and you notice the effects of them all. But the concept is there.

We Solaris users ran the risk of having such a desktop years earlier, but probably we had not the strength to shout it out loud to Sun. Which, on the other hand, wasn't able to decide with its Solaris x86 project and almost died of hesitation.

Wednesday, 5 November 2008

Choosing a laptop to connect to my home Solaris network

I need to change my (very) old laptop to something more powerful. It's been running for more or less four years and nowadays, even if it installs without problem, using Solaris Express or a modern GNU/Linux distribution is quite unthinkable. Or, I just got accustomed to more powerful machines and switching back to my laptop is always a pain.

It's a very long time I'm not buying a laptop so I started looking around. I mostly use PCs as a Java developer (listening MP3s) and the only requirement, for me, is an easy integration with my home network, which is a 100% Solaris network. I'd always been running Slackware Linux on the few PCs I owned and since two years ago, I was also running a Debian Linux virtual machine, and never experienced any integration problems with the other Solaris machines I have. Setting up DHCP on my network interfaces and configuring NFS shares it's a no brainer, even with the CLI. So, I was just looking for a sufficiently powerful machine to run Slackware without major problems: my (good) experience with Slackware started back in the 90's and I'm "inoculated" against the anxiety syndrome generated by non-working hardware.

But an interference unexpectedly appeared: a friend of mine, an Apple zealot, started to trying to convince me to buy an Apple machine. To say the truth, I must be one of the few guys in the world which isn't desiring buying a machine from Cupertino (at least for my statistically insignificant experience). GUI bells and whistles don't usually hypnotize me, neither does the beautiful and polished appearance of Apple machines. I wasn't seeing any major advantage to buying an Apple rather than an HP or a Lenovo and running GNU/Linux. Until my friend came to my house and showed me the OS X.

Connecting to the network and mounting an NFS share took approximately 5 seconds, without having used (ever) that system before. You may say that's nothing special, but: did you try that on Slackware or Debian? Even a potential problem, such as the fact that the user created by my friend for me had a different UID and GID that those I needed (and there was no way to change that with the GUI), was easily solved consulting the very good documentation of the system. I don't like opening a terminal and discovering that usermod does not exist but at least the quality of the documentation filled the gap. The price of a MacBook or a MacBook Pro isn't exagerated, compared to the price of a quality-equivalent machine from Lenovo, for example.

Some may say I could install Ubuntu and give it a try. Well, I did it. But there's no comparison with Mac OS X GUI. I'm a Solaris user and a long-time slacker, so CLIs don't scare me: I indeed prefer very often opening a terminal rather than clicking with the mouse. But I want to recognize the high quality of the GUI of OS X, which is, in my humble opinion, much more user-centric, intuitive and good-looking than any other GUI I saw on a GNU/Linux system.

Summarizing, I played an entire day with that laptop, ssh-ing to my server, opening remote X11 connections and so on. And it felt very comfortable and productive.

I really think I'll give Apple (and Mac OS X) a try.