Time Machine: Handy but Bitchy!

Patrick Jayet
XRB’s Blog
Published in
3 min readJun 30, 2009

I have been spending the last couple of days of my spare time performing a simple operation with my mac, yet slightly more complicated than expected: merge the two partitions of my hard drive into one. This was necessary since I did a mapping, quite usual on Linux, where my system was sitting on the first partition (50 GB) while my user data was on the second one (the rest of 300 GB). But this mapping was not making me happy, since the system partition was always almost full (Mac OS X is not well suited for a multi partition disk drive, I find).

Although you can resize a live partition with Disk Utility (great feature, even if you booted with it), you cannot move the base position of a partition. You can merely resize it, if more space is available. So I had to back my second partition up for later restoring it. I went for Time Machine, since I was already using it for backing up my laptop.

Time Machine Caveats

Unfortunetely I noticed a couple of caveats during the restore operation:

  • When using the Time Machine restore utility shipped with the OS X install DVD, you can only restore the partition where the system is, but not other ones. This was quite of a surpise to me. Although you can choose on which partition you want to restore your system (the target, not the source).
  • Although your data is actually sitting on the Time Machine backup drive, you cannot use it directly (i.e. copy it back using the Finder or a shell). The reason for that is the ACLs that Leopard is putting on each and every file and folder to protect changing the Time Machine backup. In addition the ACL system (which is a parralel access control to the Unix one, which I did not know the existence of beforehand) is deeply flawed: you cannot reliably remove recursively the ACLs from a directory structure (you will still find files scattered within the structure having ACLs) and you even cannot remove the ACL permissions on symbolic links (this seems to be a bug of chmod on Leopard, although ACLs on a symlink do not seem to have any effect)

Solution for merging two partitions

I finally found a solution to restore the second partition or to merge them: I had to fiddle directly with the Time Machine backup, copying manually the files I wanted from the second partition to the first, and did a restore of the first partition using Time Machine restore utility.

Here are the details of the steps I took:

  • Plug my external drive where I have my Time Machine backup, open a terminal and sudo as root:
    sudo -s
  • Deactivate on that drive the ACL checks, so that I can modify directly the Time Machine backup:
    fsaclctl -p /Volumes/[backup drive] -d
  • Move the folders from the second partition to the first one with
    mv [from] [to]
  • Reactivate the ACL checks on the external drive:
    fsaclctl -p /Volumes/[backup drive] -e
  • Do the restore of the first partition with the Time Machine restore utility (located on the Leopard install DVD).

This worked for me. You should now have a merged partition on your drive, the restore utility having removed the ACLs during the operation. Phew! This was not a straight forward action! I still cannot believe that Apple did not take into account that people can have more than 1 partition on their drive (I might still have missed the way to do it, did not find it so far though).

Links/Info

  • Macosxhint: reconnect Time Machine backup after a drive swap
  • Inspect the ACLs of your file with ls:
    ls -le
  • For the record, this will yield the following listing when ACLs are present (pay attention to the lines starting with ‘0: ‘ and ‘1: ‘:
    drwxrwxr-x@ 138 root admin 4692 Sep 13 2008 Applications
    0: group:everyone deny add_file,delete,add_subdirectory,delete_child,writeattr,writeextattr,chown
    1: group:everyone deny delete
    drwxr-xr-x@ 2 pat staff 68 May 9 22:12 DeveloperSDK3
    0: group:everyone deny add_file,delete,add_subdirectory,delete_child,writeattr,writeextattr,chown
    drwxr-xr-x@ 5 pat staff 170 Oct 23 2008 VirtualBox
    0: group:everyone deny add_file,delete,add_subdirectory,delete_child,writeattr,writeextattr,chown
  • You can also do that recursively using the following command:
    ls -lateR > filelist
  • You can remove ACLs on a file with this command (not working properly for a recursive operation with the option -R)
    chmod -a# 0 [file]
    where 0 is the ACL entry to remove.

--

--

Patrick Jayet
XRB’s Blog

Polyglot (FR, DE, EN, ES), polyglot programmer (Java, Groovy, Ruby, Swift, Objective-C, Scala, Python, O’Caml) polyglot methodologist (Scrum, Kanban, Lean).