synchronizationrenamealiasarchiveunison

Unison move root with rootalias


I changed the mounting point of the harddrive with my replica from

/media/frisch/DATEN/Dok-Daniel/ISAS to

/mnt/DATEN_SSD/ISAS

When I want to synchronize this, Unison says

Warning: No archive files were found for these roots, whose canonical names are: [...] Update detection may take a while on this run if the replicas are large.

How exactly do I have to use the rootalias option to use the old archive files (internal Unison files containing the current synchronization status) without Unison having to re-read all my files?


Solution

  • The correct syntax for rootalias is

    rootalias = //new-hostname//new-path -> //old-hostname//old-path

    (Find the hostname of your local computer by typing hostname in the command prompt.)

    So in my case, where both drives are mounted on the local computer, I have to change my command line like this:

    Old:

    unison -root "/media/frisch/DATEN_SSD/ISAS/" -root "/media/frisch/DATEN/Dok-Daniel/ISAS/"
    

    New:

    unison -root "/mnt/DATEN_SSD/ISAS" -root "/mnt/DATEN/Dok-Daniel/ISAS" \
    -rootalias "//frisch-ThinkPad-P51//mnt/DATEN_SSD/ISAS -> \
    //frisch-ThinkPad-P51//media/frisch/DATEN_SSD/ISAS" \
    -rootalias "//frisch-ThinkPad-P51//mnt/DATEN/Dok-Daniel/ISAS -> \
    //frisch-ThinkPad-P51//media/frisch/DATEN/Dok-Daniel/ISAS"
    

    Then I can synchronize the files at the new location without the slow re-reading.

    However, please keep in mind the warning from the Unison author.

    Warning: The rootalias option is dangerous and should only be used if you are sure you know what you're doing. In particular, it should only be used if you are positive that either (1) both the original root and the new alias refer to the same set of files, or (2) the files have been relocated so that the original name is now invalid and will never be used again. (If the original root and the alias refer to different sets of files, Unison's update detector could get confused.) After introducing a new rootalias, it is a good idea to run Unison a few times interactively (with the batch flag off, etc.) and carefully check that things look reasonable—in particular, that update detection is working as expected.