LoginSignup
3
2

More than 5 years have passed since last update.

How to delete old Time Machine backup with tmutil command. (then start and show backup status)

Last updated at Posted at 2016-04-11

How to delete old Time Machine backup with tmutil command.

Objective:

  • just my memorandum :)

System:

My Time Machine:

  • Ubuntu 14.04 trusty

    • netatalk 2.2.2
  • netatalk configuration

# cat /etc/netatalk/AppleVolumes.default | grep "TimeMachine-for-mba1"
/mnt/export/TimeMachine4  "TimeMachine-for-mba1"      options:usedots,upriv,tm ea:ad allow:hirofumi volsizelimit:250000

Client:

  • Mac OS X 10.11.3 (El Capitan)
# tmutil destinationinfo
====================================================
Name          : TimeMachine-for-mba1
Kind          : Network
URL           : afp://hirofumi@fs1._afpovertcp._tcp.local./TimeMachine-for-mba1
Mount Point   : /Volumes/TimeMachine-for-mba1
ID            : 41302FE3-081D-4034-8B81-F7C0FD3A0C3C

list backups:

tmutil listbackups
sample
# tmutil listbackups
/Volumes/Time Machine Backups/Backups.backupdb/Hirofumi’s MacBook Air/2016-03-31-001335
/Volumes/Time Machine Backups/Backups.backupdb/Hirofumi’s MacBook Air/2016-04-01-005550
/Volumes/Time Machine Backups/Backups.backupdb/Hirofumi’s MacBook Air/2016-04-02-003630
(snip)

delete backup(s):

tmutil delete <backup_target>
sample_for_delete_oldest
# tmutil delete "`tmutil listbackups | head -1`"
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/Hirofumi’s MacBook Air/2016-03-31-001335
Deleted (5.3G): /Volumes/Time Machine Backups/Backups.backupdb/Hirofumi’s MacBook Air/2016-03-31-001335
Total deleted: 5.3G
sample_for_delete_old_3
# for ((x=1; x<=3; x++)) ; do tmutil delete "`tmutil listbackups | head -1`" ; done
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/Hirofumi’s MacBook Air/2016-04-01-005550
Deleted (1.9G): /Volumes/Time Machine Backups/Backups.backupdb/Hirofumi’s MacBook Air/2016-04-01-005550
Total deleted: 1.9G
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/Hirofumi’s MacBook Air/2016-04-02-003630
Deleted (2.0G): /Volumes/Time Machine Backups/Backups.backupdb/Hirofumi’s MacBook Air/2016-04-02-003630
Total deleted: 2.0G
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/Hirofumi’s MacBook Air/2016-04-03-010626
Deleted (7.6G): /Volumes/Time Machine Backups/Backups.backupdb/Hirofumi’s MacBook Air/2016-04-03-010626
Total deleted: 7.6G

start backup:

tmutil startbackup

show backup state:

ref. http://apple.stackexchange.com/questions/162464/time-machine-progress-from-the-command-line

tmutil status
sample1
# tmutil status
Backup session status:
{
    BackupPhase = Copying;
    ClientID = "com.apple.backupd";
    DateOfStateChange = "2016-04-11 12:07:18 +0000";
    DestinationID = "41302FE3-081D-4034-8B81-F7C0FD3A0C3C";
    DestinationMountPoint = "/Volumes/Time Machine Backups";
    Percent = "0.04944647446240578";
    Progress =     {
        TimeRemaining = 3823;
        "_raw_totalBytes" = 4347141887;
        bytes = 238834267;
        files = 9550;
        totalBytes = 4781856075;
        totalFiles = 9550;
    };
    Running = 1;
    Stopping = 0;
    "_raw_Percent" = "0.05494052718045087";
}
sample2
# tmutil status | awk '/_raw_Percent/ {print $3}' | grep -o '[0-9].[0-9]\+' | awk '{print $1*100,"% backed up"}'
17.8677 % backed up
3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2