Add restoring root

Add restoring root and refator prepare/finish restore in machine.go