Mac OS X encrypted Timemachine USB-drive
Wednesday, May 22. 2013
I got a new iMac and wanted to use an USB-drive as Time Machine backup destination for it. When it comes to easily movable backup-drives, my policy is to encrypt them. If a drive is lost/stolen/misplaced, other people don't get to access my data.
When OS X sees an empty USB-drive, and there is no Time Machin already set up, it asks if you'd like to use the newly found drive as Time Machine backup destination, which is nice and user friendly. During Time Machine setup, there is a checkbox "Encrypt drive". I checked it, but whatwhatwhat?! It refused to work. Error message:
There was an error preparing the Time Machine backup disk "TimeMachine" and an additional explanation: The given file system is not supported on Core Storage.
Well... that's strange. I have no idea what a Core Storage is, or why an Apple formatted HFS+ partition would not be a valid (encrypted) backup destination.
Here is what I did. My drive was already formatted when I got it:
$ diskutil list disk3
/dev/disk3
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *1.0 TB disk3
1: EFI 209.7 MB disk3s1
2: Microsoft Basic Data WD Backup 1000.0 GB disk3s2
There is a 1 TiB Western Digital drive with a NTFS-partition on it. So I had to delete the partition and create a better suitable one:
$ diskutil partitionDisk disk3 1 GPT HFS+ TimeMachine 1T
Started partitioning on disk3
Unmounting disk
Creating the partition map
Waiting for the disks to reappear
Formatting disk3s2 as Mac OS Extended with name TimeMachine
Initialized /dev/rdisk3s2 as a 931 GB HFS Plus volume
Mounting disk
Finished partitioning on disk3
/dev/disk3
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *1.0 TB disk3
1: EFI 209.7 MB disk3s1
2: Apple_HFS TimeMachine 999.9 GB disk3s2
This is the partition setup that refuses to work.
After couple of hours of Googling I found the solution:
$ diskutil enableJournal disk3s2
Journaling has been enabled for volume TimeMachine on disk3s2
I seem to have misplaced the links already. Sorry. Anyway, the problem was that I didn't enable journaling on the partition. I can understand why that is a requirement for Time Machine. Having a journaled partition adds robustness to write operations. The real questions are:
- Why creating a HFS+ partition does not enable journaling automatically?
- On Linux creating EXT2 or EXT3 partition does not enable journaling automatically
- On Linux creating EXT4 journaling is enabled by default
- Why doesn't Time Machine state the reason?
- Saying that Core Storage is not supported is a bit vague!
Mac OS X terminal UTF-8 over SSH
Tuesday, May 21. 2013
Something weird happens in OS X Terminal locale settings. Whenever I open an SSH-connection to one of my Linux-boxes, they refuse to properly set up an UTF-8 locale.
The session goes something like this. Checking locale settings on OS X terminal:
$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
Open SSH-connection and check locale settings on Linux end:
~> locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE=UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
Aow come on! Something went wrong.
The fix on the OS X end is not to set the environment variables. In the Terminal settings, there is:
The setting Set locale environment variables on startup needs to be UNset. It is checked out-of-the-box. Then it yields:
$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
The LC_CTYPE is not set. Over SSH-connection to Linux, it yields:
~> locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
Now there are no error messages. The next thing to do is to try to find somebody responsible. Whose job it is to fix this.
Limiting Time Machine backup size on NAS
Monday, May 6. 2013
Earlier I wrote about getting a Linux-based NAS-box to host Apple Time Machine backups.
I was reviewing my settings on the Mac and realized the text in the Time Machine:
Well... I have lots of disk space there. Not all of it is can be taken by my Mac's backups, so ... Something needed to be done.
I mounted the AFP-share and confirmed the max size of my sparsebundle:
hdiutil imageinfo Mac\ mini.sparsebundle/
It said (unsurprisingly):
Size Information:
Total Bytes: 8855484092416
That is 8+ TiB!! Oh my! There is no way that I can afford to have that much of Apple backups. Luckily there is a way to reduce the size:
hdiutil resize -size 500g -shrinkonly Mac\ mini.sparsebundle/
Now checking the size will yield something reasonable (500 GiB):
Size Information:
Total Bytes: 537214885888
That is something, that I can easily accept.
The information came from:
- http://untoro.wordpress.com/2011/06/07/how-to-limit-space-used-by-time-machine/
- http://nikhilhaas.com/blog/limit-size-of-time-machine-backup-on-wd-my-book-live/
Also I did this to limit the size. I have no idea if it actually does anything.
defaults write /Library/Preferences/com.apple.TimeMachine MaxSize 405600
Perhaps somebody can comment this.
Mac OS X Dolby Digital 5.1 with Mac Mini [Not solved]
Tuesday, April 9. 2013
Update 30th Dec 2013:
Anything I say below is subject to debate. This issue is not clear, see the new article about Mac Mini HDMI Dolby Digital audio output.
My mini is mainly for entertainment purposes and I chose to use it at living room. That should be an easy setup, right? Just plug the HDMi-output of the mini into my Yamaha amp which is connected to my Sony TV and everything will work out just fine. No.
Video-signal passes through the amp and TV displays it as supposed in correct resolution and frame rate. No glitches there. But the audio-signal has issues, there were only disappointing two channels. I was expecting to see 5.1 channels as my Yamaha amp has been set up already.
First I confirmed that my Mac Mini supported multichannel output (2 channels as stereo is not multi). There is no adapter in my setup (About Mini DisplayPort to HDMI adapters @ Apple support), so initially I had to assume that HDMi-port supports multichannel audio since my model is newer than mid 2010 and newer than early 2009 with adapter. To my understanding 2009 is the point where multichannel audio was possible without 3rd party add-ons. Anyway, I'm way above that line and should have the support.
Apple support forums have vast number of discussion threads about getting 5.1 sound. It is apparent, that for some reason, this is a problematic issue. I'm saying that the reason is: it does not work out-of-the-box as most Apple fans are used to doing everything in the Apple-land.
After numerous failing attempts I finally managed to get my setup working. At one point I realized that my mini is displaying audio status based on my TV, which obviously can produce only stereo sound. There is the amp in the HDMi-chain, and mini should detect audio by that. When I enable multichannel output from OS X:
... my amp does not reflect the change. It still displays the input signal as stereo. This is not typical behaviour. My amp correctly detects the type of the audio signal on all of my other devices. The fact that I missed was, that I can force the amp to do 7-channel signal:
... then 5.1 sound works perfectly.
Testing that everything works ok is very simple: In the MIDI-sound app there is the test-button. When each channel produces sound correctly, I downloaded a couple of movie trailes from http://trailers.apple.com/ and verified that all was as it was supposed to be.
Hope this helps somebody struggling with multi-channel issues.