12

I googled for hours to find a solution for this issue, but I couldn't find an answer that fitted for my problem.

My setup:

  • I have an iMac with a ~1TB Hard Drive
  • I'm backing it up via Time Machine to a Synology NAS DS214+ with ~2.7TB Space

My problem:

  • I forgot to set a size limit for the backup user. No my Time Machine Backup uses about 2.3TB space. That's not cool.
  • I can't set a quota to the Synology user, because it beginns to count starting zero.

What I want to do:

  • If anyhow possible I want to tell my Time Machine Backup to shrink automatically to a limit of ~1.5TB by deleting the oldest backups.
  • Then I want the sparse bundle to not get bigger anymore.

Does anyone of you see a solution? Or do I have to delete all my old backups to reach my goal?

1
  • Just FYI: I'm using OS X Yosemite 10.10.3 and the current firmware on my Synology NAS.
    – michael
    Commented May 3, 2015 at 9:08

5 Answers 5

3

Time Machine will respect a size determination - but only when you make the container. This functionality is all that Apple provides for native backup so you'd need a custom setup to do what you ask, and you can't limit things once you've started backing up to a container.

Going forward if you want to make a new restricted container, the concept isn't hard to map out though.

  • make a new container on the synology and be sure to enforce the size constraints when you start the process.

Server.app does that easily - I'm not aware of synology code that reverse engineered that feature, but would be surprised if it's not on GitHub or published somewhere public.

At that point, you could delete all backups of user folders that are large and then block by block copy the old backup data to the new destination and then inherit the backup.

You can also thin backup intervals from the command line or script this automation as well.

Lots and lots of work, but it might be worth it as a project if someone is inclined.

When I'm in your shoes, I just copy off the old "too large" backup to an offline hard drive and put it on a shelf and start over with new backups of the size you like. In 6 months or a year - wipe that old drive unless you really feel you need that older history.

4
  • Excatly what I did: I started with a new Time Machine Backup. Thanks for answering though!
    – michael
    Commented Aug 28, 2017 at 17:37
  • TimeMachine has a setting to set a Maxsize for the sparsebundle, but in my experience this only works for new sparsebundles, not existing ones. The only solution to his problem is to delete old backups and my solution is the best way to do that. Commented Mar 11, 2019 at 21:17
  • 1
    Agreed - should I bold the but only when you make the container or change that to be more clear @RobertBarrueco
    – bmike
    Commented Mar 11, 2019 at 22:49
  • I found that "Disk Utility" could resize the Time Machine container if it had free space inside, which in turn caused Time Machine to use the new, smaller container size as the limit. This was on my Time Capsule. My guess is that the initial container is constructed from the free space available then. Commented Feb 29, 2020 at 17:18
3

This is the easiest solution using OSX Terminal.

Get a list of all the backups in TimeMachine. This will also show you the full directory path to the backups that you will need in step 2...

$ tmutil listbackups

/Volumes/Time Machine Backups/Backups.backupdb/{your-macbook}/2018-10-02-213405
/Volumes/Time Machine Backups/Backups.backupdb/{your-macbook}/2018-10-09-192323
/Volumes/Time Machine Backups/Backups.backupdb/{your-macbook}/2018-10-19-212659

Choose which backups to delete based on their date. Note the use of a wildcard * and the use of the directory from step 1. For example, to delete all of 2018's backups you would use this:

$sudo tmutil delete '/Volumes/Time Machine Backups/Backups.backupdb/{your-macbook}/2018-'*

The final step is to shrink and recover space from the sparse bundle. Search your backup drive for the .sparsebundle file.

$ sudo hdiutil compact '/Volumes/{your-mac}.sparsebundle'

2
0

Shrink the backup volume to the desired size. Time Machine is designed to keep adding backups until the volume is full, then prune older copies. It is NOT designed to share storage space with other things, nor to leave X gigabytes free on the destination.

2
  • 5
    Well, I can't shrink the volume, because it already takes more space than wanted. That's my problem.
    – michael
    Commented May 3, 2015 at 15:24
  • 3
    how would you shrink the volume?
    – Natsfan
    Commented Jul 24, 2017 at 2:31
0

I agree with the answer given earlier, though what you could try is to manually delete Time Machine backups (at your own risk).

If you mount the volume, there is a folder called "Backups.backupdb" (it may be looking slightly different on remote backups). Inside it will have your computer name and then either the dates or the volumes, or vice versa (sorry, I am currently away from my own Mac and cannot check the exact order).

If you remove some earlier date folders, you will free up some space in order to resize the volume.

NOTE: Keep in mind that Time Machine is an incremental backup using hardlinks for unchanged files. So, removing one date folder, may not remove the amount of space it states to be sized at.

2
  • 2
    This site says to delete your backups using sudo tmutil delete.
    – Harvey
    Commented Mar 9, 2016 at 15:14
  • Time Machine shares unchanged files by hardlink. If you delete an entire backup, files that are used by other backups are not deleted, only the links.
    – WGroleau
    Commented Sep 11, 2018 at 22:41
0
momomo.com.apple.timemachine.backups.list() {
        tmutil listbackups
}
momomo.com.apple.timemachine.backups.compact() {
        local leave="${1}";

        if [[ "${leave}" == "" ]]; then leave="5"; fi

        local backups=(
                $(momomo.com.apple.timemachine.backups.list)
        )

        local length="${#backups[@]}"
        local     to="(("${length}"-"${leave}"))"

        local i=0; while [[ "${i}" -lt "${to}"  ]]; do
                local backup="${backups[i]}"

                sudo tmutil delete "${backup}"

                echo -e "\n\n"

                ((++i))
        done   
}

Example:

# To leave last 10 on disk and remove all previous before
momomo.com.apple.timemachine.backups.compact 10 

Can be called repeatedly.

    Deleting: /Volumes/backupdisk-1/Backups.backupdb/m-desktop-2/2019-12-21-001329
    Deleted (4.6G): /Volumes/backupdisk-1/Backups.backupdb/m-desktop-2/2019-12-21-001329
    Total deleted: 4.6G

    Deleting: /Volumes/backupdisk-1/Backups.backupdb/m-desktop-2/2019-12-28-001355
    Deleted (5.1G): /Volumes/backupdisk-1/Backups.backupdb/m-desktop-2/2019-12-28-001355
    Total deleted: 5.1G

    Deleting: /Volumes/backupdisk-1/Backups.backupdb/m-desktop-2/2020-01-04-001349
    Deleted (6.6G): /Volumes/backupdisk-1/Backups.backupdb/m-desktop-2/2020-01-04-001349
    Total deleted: 6.6G

    Deleting backup: /Volumes/backupdisk-1/Backups.backupdb/m-desktop-2/2020-01-11-002303
    ...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .