+ utils.makedirs(SYSIMG_PATH)
+
+ # xxx - TODO - need to fsck the btrfs partition
+ if vars['virt'] == 'vs':
+ filesystems_tocheck = ['root', 'vservers']
+ else:
+ filesystems_tocheck = ['root']
+
+ for filesystem in filesystems_tocheck:
+ try:
+ # first run fsck to prevent fs corruption from hanging mount...
+ log.write("fsck {} file system\n".format(filesystem))
+ utils.sysexec("e2fsck -v -p {}".format(PARTITIONS[filesystem]), log, fsck=True)
+ except BootManagerException as e:
+ log.write("BootManagerException during fsck of {} ({}) filesystem : {}\n"\
+ .format(filesystem, PARTITIONS[filesystem], str(e)))
+ try:
+ log.write("Trying to recover filesystem errors on {}\n".format(filesystem))
+ utils.sysexec("e2fsck -v -y {}".format(PARTITIONS[filesystem]), log, fsck=True)
+ except BootManagerException as e:
+ log.write("BootManagerException while trying to recover"
+ "filesystem errors on {} ({}) filesystem : {}\n"
+ .format(filesystem, PARTITIONS[filesystem], str(e)))
+ return -1
+ else:
+ # disable time/count based filesystems checks
+ utils.sysexec_noerr("tune2fs -c -1 -i 0 {}".format(PARTITIONS[filesystem]), log)