Posted by: untoro | June 7, 2011

How to limit space used by Time Machine

Having an external HD gives me a chance to use Time Machine to backup all my data.
Even though the initial process (first backup) is very slow, I am so impressed to see Time Machine in action. Now I can easily check how my Mac looks like, let’s say for yesterday’s date at particular hour. Just like its name, Time Machine.

At particular hour you said? Yes, by default Time Machine will create:

  • Hourly backups for the past 24 hours
  • Daily backups for the past month
  • Weekly backups for all previous months
However, there is one important information in the Time Machine Preferences window:
The oldest backups are deleted when your disk becomes full


What???? I did not buy this HD only to store Time Machine backups! Why there is no setting to limit the space used by Time Machine???
If you use external HD, I believe you can prepare separate partition with limited space for Time Machine. But, here I am not sure on how to do that in NAS (I am using MyBook Live).
After a whole day Googling, trial & error, and Googling, and trial & error (you can repeat this 5x), I managed to set limit on the image size used by Time Machine.
Before you go further on how to do this, all the steps were done in Mac OS X 10.6.7 and I am using MyBook Live 2TB for my NAS.


Here are the steps:

  1. First, switch off your time machine. You can do this from the Time Machines Preferences window. Just to be safe, I also set the Disk to None by clicking “Select Disks” and choose “None”
  2. (Edited on 11.04.2012 to add info on mounting the backup volume – Thx to Gumlor).
    Mount the backup volume and go into terminal to resize sparsebundle used by Time Machine by using hdiutil command.

    To mount the backup volume: Finder > Go > Connect to Server…
    Enter the “Server Address” (change the disk name with your own one):


    Use hdiutil command in the Terminal:

    hdiutil resize -size 500g -shrinkonly /Volumes/TimeMachine/PC-benk2.sparsebundle/

    On the example above, the maximum size of the sparsebundle image is 500GB. However, the exact size will be 1024*1024*1024*500 = 536.87GB.
    You will need to change the path and name for the sparsebundle accordingly.

    – You may need to use sudo to execute hdiutil.
    – If you got “hdiutil: resize failed – error -5341” as what I got at first time, try to reduce the size in several steps.
    In my case, first I reduce the size to 1t (1 Terabyte) and to 500g subsequently.

  3. By default, Time Machine will again resizing the image up to the max when the backup is running.
    To avoid this you need to lock the Info.* files in sparsebundle by using SetFile from Terminal.
    You can get SetFile by installing Developer Tools (Xcode.mpkg) from Installation DVD.

    SetFile -a L /Volumes/TimeMachine/PC-benk2.sparsebundle/Info.*


  4. Now you can choose set the disk back from the Time Machine Preferences window and switch ON.From time machine preferences, the available space will still show the maximum size of your HD.
  5. Open the Console from Application\Utilities to check the log and run the backup. Here in my system, I am getting below in the log:

    6/7/11 12:50:47 PM[13149] Starting standard backup 6/7/11 12:50:47 PM[13149] Network destination already mounted at: /Volumes/TimeMachine 6/7/11 12:50:47 PM[13149] Warning: Destination /Volumes/TimeMachine does not support TM Lock Stealing 6/7/11 12:50:47 PM[13149] Warning: Destination /Volumes/TimeMachine does not support Server Reply Cache 6/7/11 12:50:48 PM[13149] Resizing backup disk image from 500.0 GB to 1851.3 GB 6/7/11 12:50:55 PM[13149] Could not resize backup disk image (DIHLResizeImage returned 30) 6/7/11 12:50:56 PM[13149] QUICKCHECK ONLY; FILESYSTEM CLEAN 6/7/11 12:50:59 PM[13149] Disk image /Volumes/TimeMachine/PC-benk2.sparsebundle mounted at: /Volumes/Time Machine Backups 6/7/11 12:50:59 PM[13149] Backing up to: /Volumes/Time Machine Backups/Backups.backupdb 6/7/11 12:51:01 PM[13149] No pre-backup thinning needed: 1.01 GB requested (including padding), 259.52 GB available 6/7/11 12:51:11 PM[13149] Copied 627 files (2.2 MB) from volume Macintosh HD. 6/7/11 12:51:12 PM[13149] Starting post-backup thinning 6/7/11 12:51:14 PM[13149] Deleted backup /Volumes/Time Machine Backups/Backups.backupdb/PC-benk2/2011-06-06-124852: 259.52 GB now available 6/7/11 12:51:16 PM[13149] Deleted backup /Volumes/Time Machine Backups/Backups.backupdb/PC-benk2/2011-06-06-114856: 259.53 GB now available 6/7/11 12:51:20 PM[13149] Deleted backup /Volumes/Time Machine Backups/Backups.backupdb/PC-benk2/2011-06-06-104854: 259.54 GB now available 6/7/11 12:51:20 PM[13149] Post-back up thinning complete: 3 expired backups removed 6/7/11 12:51:20 PM[13149] Backup completed successfully.

    As you can see, Time Machine is unable to resize the image size 🙂

  6. Check the Time Machine volume, and it shows the correct size.


Just to ensure everything works fine, I also restart my Mac and reboot my NAS and recheck the log when the backup run. So far until now it is still working fine.
Please feels free to comment.
I am not an expert on this, so please let me know in case the steps might harm my system.



  1. it’s generally a bad idea to alter a backup system’s data store behind its back. you’re asking for trouble.

    you’re much better off partitioning the disk of the NAS so your sparsebundle is limited to that. and then you should file a bug with apple to request this functionality.

    • as far as I know, you can’t create partitions on MyBookLive NAS

  2. Hi,

    I tried to do what you suggest here but I always get the error Message:

    hdiutil: resize: only a single file can be specified
    Usage: hdiutil resize [options]
    hdiutil resize -help

    This is how my command looks like:

    sfroehlich-mbp:TimeMachine stivi$ sudo hdiutil resize 1t -shrinkonly /Volumes/TimeMachine/sfroehlich_mbp.sparsebundle/

    Any idea?

    Thanks 🙂

    • “-size” key is missing.

      • thks for your comment.

        apart from that, i have the problem now, that I can’t mount the volume without actively backing up so the way it is done here doesn’t work for me because when u remove the backup disk in TM there is no way to mount and access to backup volume.

        any idea how to solve this issue?

        thanks in adance!

  3. Same problem as @stivi here. the command in step 2 results in the following error:

    > hdiutil: resize: failed. No such file or directory (2)

    Seems like the cause is the disk image xxxxx.sparsebundle is NOT mounted (or has been unmounted after Time Machine has done its job).

    I tried to use “mount” and “mount_afp” commands to mount it, but couldn’t figure out how it’s done.

    How did you make step 2 work? Was TM running backup while you did it?

    Many Thanks!!
    (I’m using Mac OS X 10.6.8 and MyBook Live 2TB for NAS)

  4. Alright, just figured that out!

    Finder > Go > Connect to Server…
    > Enter in “Server Address”:

    Then “MyBookLive-tm” shows up under “SHARED” in the finder sidebar. Clicking on it shows “TimeMachine” as the root folder, which contains my xxxx.sparsebundle.

    Then I tried your step 2. You’re right, it hit the error “hdiutil: resize failed – error -5341”

    And the steps follows worked like a charm.

    Thanks @untoro

    • Thx Gumlor, I missed that part :D.
      I have now updated the post with step to mount the backup volume

  5. I kept recieving error –
    hdiutil: resize: failed. Resource temporarily unavailable (35)

    Which remarkably is not a well documented error. Google returned a whole 75 search results, non of which BTW were helpful.

    I rebooted my Mac and did not receive the error afterwards.

    Why does apple force us to “trick” its programs? Why not let us have a simple option to let us chose our own file size?

  6. When I try to lock the file with setfile I get:

    -bash: setfile: command not found

    I have Xcode (4.3.3) installed but not sure why setfile command isnt found

  7. worked thx!

  8. Thanks, working great on 10.8 + Time Capsule
    SetFile location is

  9. you do not need SetFile – you can use this method:

    changing nouchg to uchg if you need to unlock the info files.

    I am stuck with the only a single file can be specified – whether I drag the bundle itself – or the mounted result ir the contents of that – I know I have done this before – but now I want to increase the limit on one of my sparsebundles because I have more space on my RAID array than I was expecting after everything else is done – and NO it would NOT have been easier to carve up my RAID array into separate chunks for each backup device – not needing to decide in advance where the boundaries between backups need to be is one of the benefits of using this method.

  10. oops – found my problem – forgot the dash in front of the shrink only – working now

  11. This hack works like a charm. Its the only viable solution on a shared NAS backup. Good job hunting this down. It is much appreciated.

  12. Normally I do not read article on blogs, however I would like to say that this write-up very pressured me to check out and do it!

    Your writing style has been surprised me. Thanks, quite nice article.

  13. Following readinging this article, I had to remark on
    your segment of Washington, DC. I concur with all of the activites
    and employment opportunties, etc that the area needs to supply.
    But I’d need to disagree that “there are somewhat far more ladies than guys in Washington, D.C., but approximately 33% in the populace is one.” Slightly is an understatement! You will find Much more girls than guys, about 7-8 females far more than guys. Considering the population’s ethnic qualifications, courting choices and sexualty,
    these stats vary. Numerous social businesses,
    meetups, and clubs host social and cultural occasions,
    including relationship occasions that often are in need to have of far more guys.
    And on account of there be much more guys than females,
    many of these want to carry on to become single and get pleasure from the many solitary females inside the location instead of settling down to have a family members.
    I invite you to take a video clip camera towards
    the streets of DC and job interview the women and find out what sort
    of feedback you receive contradictory for your stats.

  14. Wait ’til you’re 18 partner.

  15. Wow that was odd. I just wrote an really long comment but
    after I clicked submit my comment didn’t show up. Grrrr… well I’m not writing all that over
    again. Anyway, just wanted to say excellent blog!

  16. […] The busiest day of the year was May 6th with 181 views. The most popular post that day was Flax Meal Pizza Crust. […] Click

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: