backup ported and adopted from (old) backup sh script

Change-Id: Ia9115847856661b7f45655928cea960990597b34