我用我的副本更改了硬盘驱动器的安装点
/media/frisch/DATEN/Dok-Daniel/ISAS
到
/mnt/DATEN_SSD/ISAS
当我想同步这个的时候,Unison 说
警告:未找到这些根的存档文件,其规范名称为:[...] 如果副本很大,则在此运行时更新检测可能需要一段时间。
我究竟该如何使用 rootalias
使用旧存档文件(包含当前同步状态的内部 Unison 文件)而 Unison 不必重新读取我的所有文件的选项?
最佳答案
rootalias 的正确语法是
rootalias =//new-hostname//new-path ->//old-hostname//old-path
(通过在命令提示符中键入 hostname
查找本地计算机的主机名。)
所以在我的例子中,两个驱动器都安装在本地计算机上,我必须像这样更改我的命令行:
旧:
unison -root "/media/frisch/DATEN_SSD/ISAS/" -root "/media/frisch/DATEN/Dok-Daniel/ISAS/"
新:
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"
然后我可以在新位置同步文件,而无需缓慢的重新读取。
但是,请记住 Unison 作者的警告。
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 newrootalias
, it is a good idea to run Unison a few times interactively (with thebatch
flag off, etc.) and carefully check that things look reasonable—in particular, that update detection is working as expected.
关于synchronization - Unison 移动 root 与 rootalias,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53118063/