Added sync after restore. Added formatting of boot, system and data partitions