How to restore a time machine backup of a USB drive to a new USB drive? One of my external USB disks died. I want to restore the time machine backup to a new (bigger) external USB disk. 

I could just copy the latest backup to the new disk, but I want to keep the backup history, so that time machine uses the new disk as a replacement for the old disk (with all the backup history).
I found a solution that does use the existing backup. The trick is to use sudo tmutil associatedisk (see man tmutil).

My old disk was mounted under /Volumes/USB-old and the new disk is mounted as /Volumes/USB-new. My backup is under /Volumes/backups. (If your old and new disk have both the same name, you have to follow all of the steps, because the name of the disk is not sufficient to associate an old backup with a new disk)


Stop time machine to do backups (in the preferences)
Restore the old data to the new disk:

sudo tmutil restore /Volumes/backups/Backups.backupdb/MacBookPro/Latest/USB-old/* /Volumes/USB-new


(note this does not restore files starting with . at the top level)
Tell time machine to associate the new disk to the old backups:

sudo tmutil associatedisk /Volumes/USB-new /Volumes/backups/Backups.backupdb/MacBookPro/Latest/USB-old

Start time machine to do backups


Now time machine does not try to backup the entire new disk. Instead, it creates incremental backups based on the old snapshot.

However, it seems not possible to go back in history using Time Machine.
I have tried to associate all old backups with the new disk without much success:

for dir in `find /Volumes/backups/Backups.backupdb/MacBookPro -maxdepth 2 -name USB-old`; do 
    echo sudo tmutil associatedisk /Volumes/USB-new $dir
done