Time Machine must create a new backup for you

by lars on 1/11/2013

No. Just no.

If you have a NAS like Synology or QNAP, you might have seen this error. Letting Time Machine create a new backup for you, means you lose all old backups.

Fortunately it’s usually repairable. I have done this many times on my QNAP, and a few times on the Synology at work. Oddly OSX doesn’t do it automatically, which is silly, because it should be able to.

First you need to ensure that you are connected to your time machine share on your NAS. You can see this in your finder, under your NAS’ server name. If you don’t see it, click on your NAS server name in finder and see if is there. If it isn’t there, then maybe the Time Machine user on your NAS is different from your “normal” username. From finder, select the “Go” menu, then “Connect to Server…”. Usually the format for the connection is:

afp://IP.OF.YOUR.NAS/Time Machine

Specify your Time Machine username and password. When it succeeds, you are ready to start repairing your Time Machine backup. Open up a terminal, and issue the command:

sudo su –

Then enter your administrator password and continue with:

chflags -R nouchg /Volumes/THE-SHARE/YOUR-MACHINE.sparsebundle

THE-SHARE is usually just “Time\ Machine”. YOUR-MACHINE is usually the name of your machine.
This command will take a while to complete. When it’s complete you can issue the next command:

hdiutil attach -nomount -noverify -noautofsck /Volumes/YOUR-SHARE/YOUR-MACHINE.sparsebundle

This will produce output similar to this:

/dev/disk1              GUID_partition_scheme
/dev/disk1s1            EFI
/dev/disk1s2            Apple_HFS

Open up a new terminal window and issue the command:

tail -f /var/log/fsck_hfs.log

This will tell you what the file system checker/repairer is doing.
You should see some output like this:

/dev/rdisk1s2: fsck_hfs started at Thu Oct 31 11:46:42 2013
/dev/rdisk1s2: /dev/rdisk1s2: ** /dev/rdisk1s2 (NO WRITE)
/dev/rdisk1s2:    Executing fsck_hfs (version hfs-226.1.1).
QUICKCHECK ONLY; FILESYSTEM DIRTY
/dev/rdisk1s2: fsck_hfs completed at Thu Oct 31 11:46:42 2013

Back to the first terminal. The next command:

fsck_hfs -drfy /dev/diskXsX

Where diskXsX needs to be replaced with what the previous command outputted as Apple_HFS, in this case disk1s2.
If you have a lot of RAM on your machine, you can issue another command INSTEAD of this, with an added parameter:

fsck_hfs -drfy -c 750 /dev/diskXsX

The other terminal window should start showing some output.

When the command has finished executing, look for either “The Volume was repaired successfully”), or if it failed “The Volume could not be repaired”.
If it succeeded, skip to the next step, otherwise try issuing the following two commands:

fsck_hfs -p /dev/diskXsX
fsck_hfs -drfy /dev/diskXsX

Again, the last of them with -c 750 if you have lots of RAM.

When the log in the second terminal window indicates that the repair was successful (“The Volume was repaired successfully”), issue the command:

hdiutil detach /dev/diskXsX

Then:

nano /Volumes/YOUR-SHARE/YOUR-MACHINE.sparsebundle/com.apple.TimeMachine.MachineID.plist

Which opens the nano terminal text editor. Locate the line with:

<key>RecoveryBackupDeclinedDate</key>

And delete that line, and the line immediately after (the <date>-line).

Locate the line with

<key>VerificationState</key>

Change the <integer>-field below it from 2 to 0.

Press CTRL+X and save it.

Now to the finder and eject the Time Machine share.

You should now be good to go!