def commit(self): try: self._disk.commit() except: sysutils.run("sync") time.sleep(3) sysutils.run("sync") log.error("Commit Failed!") self._disk.commit() self._isSetup = False
def setLabel(self, partition, label): label = self.availableLabel(label) cmd_path = requires("dosfslabel") cmd = "%s %s %s" % (cmd_path, partition.path, label) if not sysutils.run(cmd): return False return label
def format(self, partition): self.preFormat(partition) cmd_path = requires("mkfs.vfat") cmd = "%s %s" %(cmd_path,partition.path) res = sysutils.run(cmd) if not res: raise rror, "vfat format failed: %s" % partition.path
def setLabel(self, partition, label): label = self.availableLabel(label) cmd_path = requires("xfs_admin") cmd = "%s -L %s %s" % (cmd_path, label, partition.path) if not sysutils.run(cmd): return False return label
def format(self, partition): self.preFormat(partition) cmd_path = requires("mkfs.xfs") cmd = "%s -f %s" % (cmd_path, partition.path) res = sysutils.run(cmd) if not res: raise rror, "%s format failed: %s" % (self.name, partition.path)
def format(self, partition): self.preFormat(partition) cmd_path = requires("mkfs.xfs") cmd = "%s -f %s" %(cmd_path, partition.path) res = sysutils.run(cmd) if not res: raise rror, "%s format failed: %s" % (self.name, partition.path)
def setLabel(self, partition, label): label = self.availableLabel(label) cmd_path = requires("xfs_admin") cmd = "%s -L %s %s" % (cmd_path, label, partition.path) if not sysutils.run(cmd): return False return label
def setLabel(self, partition, label): label = self.availableLabel(label) cmd_path = requires("reiserfstune") cmd = "%s --label %s %s" % (cmd_path, label, partition.path) if not sysutils.run(cmd): return False return label
def format(self, partition): self.preFormat(partition) cmd_path = requires("mkfs.vfat") cmd = "%s %s" % (cmd_path, partition.path) res = sysutils.run(cmd) if not res: raise rror, "vfat format failed: %s" % partition.path
def setLabel(self, partition, label): label = self.availableLabel(label) cmd_path = requires("reiserfstune") cmd = "%s --label %s %s" % (cmd_path, label, partition.path) if not sysutils.run(cmd): return False return label
def setLabel(self, partition, label): label = self.availableLabel(label) cmd_path = requires("dosfslabel") cmd = "%s %s %s" % (cmd_path, partition.path, label) if not sysutils.run(cmd): return False return label
def getLabel(self, partition): """ Read file system label and return """ cmd_path = requires("e2label") cmd = "%s %s" % (cmd_path, partition.path) label = sysutils.run(cmd, capture=True) if not label: return False return label.strip()
def tune2fs(self, partition): """ Runs tune2fs for given partition """ cmd_path = requires("tune2fs") # Disable mount count and use 6 month interval to fsck'ing disks at boot cmd = "%s -c 0 -i 6m %s" % (cmd_path, partition.path) res = sysutils.run(cmd) if not res: raise PareError, "tune2fs tuning failed: %s" % partition.path
def getLabel(self, partition): """ Read file system label and return """ cmd_path = requires("e2label") cmd = "%s %s" % (cmd_path, partition.path) label = sysutils.run(cmd, capture=True) if not label: return False return label.strip()
def tune2fs(self, partition): """ Runs tune2fs for given partition """ cmd_path = requires("tune2fs") # Disable mount count and use 6 month interval to fsck'ing disks at boot cmd = "%s -c 0 -i 6m %s" % (cmd_path, partition.path) res = sysutils.run(cmd) if not res: raise PareError, "tune2fs tuning failed: %s" % partition.path
def setLabel(self, partition, label): label = self.availableLabel(label) cmd_path = requires("e2label") cmd = "%s %s %s" % (cmd_path, partition.path, label) if not sysutils.run(cmd): return False # Check label consistency if not self.getLabel(partition) == label: return False return label
def setLabel(self, partition, label): label = self.availableLabel(label) cmd_path = requires("e2label") cmd = "%s %s %s" % (cmd_path, partition.path, label) if not sysutils.run(cmd): return False # Check label consistency if not self.getLabel(partition) == label: return False return label
def setLabel(self, partition, label): label = self.availableLabel(label) cmd_path = requires("mkswap") cmd = "%s -v1 -L %s %s" % (cmd_path, label, partition.path) if not sysutils.run(cmd): return False # Swap on sysutils.swap_on(partition.path) return label
def setLabel(self, partition, label): label = self.availableLabel(label) cmd_path = requires("mkswap") cmd = "%s -v1 -L %s %s" % (cmd_path, label, partition.path) if not sysutils.run(cmd): return False # Swap on sysutils.swap_on(partition.path) return label
def resize(self, size, partition): """ Resize given partition as given size """ if size < self.minResizeMB(partition): return False cmd_path = requires("resize2fs") # Check before resize self.preResize(partition) res = sysutils.run("resize2fs",[partition, "%sM" %(size)]) if not res: raise FileSystemError, "Resize failed on %s" % (partition) return True
def resize(self, size, partition): """ Resize given partition as given size """ if size < self.minResizeMB(partition): return False cmd_path = requires("resize2fs") # Check before resize self.preResize(partition) res = sysutils.run("resize2fs", [partition, "%sM" % (size)]) if not res: raise FileSystemError, "Resize failed on %s" % (partition) return True
def format(self, partition): """ Format the given partition """ self.preFormat(partition) cmd_path = requires("mkfs.%s" % self.name) # bug 5616: ~100MB reserved-blocks-percentage reserved_percentage = int(math.ceil(100.0 * 100.0 / partition.size)) # Use hashed b-trees to speed up lookups in large directories cmd = "%s -O dir_index -q -j -m %d %s" % (cmd_path, reserved_percentage, partition.path) res = sysutils.run(cmd) if not res: raise PareError, "%s format failed: %s" % (self.name, partition.path) # for Disabling Lengthy Boot-Time Checks self.tune2fs(partition)
def format(self, partition): """ Format the given partition """ self.preFormat(partition) cmd_path = requires("mkfs.%s" % self.name) # bug 5616: ~100MB reserved-blocks-percentage reserved_percentage = int(math.ceil(100.0 * 100.0 / partition.size)) # Use hashed b-trees to speed up lookups in large directories cmd = "%s -O dir_index -q -j -m %d %s" % ( cmd_path, reserved_percentage, partition.path) res = sysutils.run(cmd) if not res: raise PareError, "%s format failed: %s" % (self.name, partition.path) # for Disabling Lengthy Boot-Time Checks self.tune2fs(partition)
def check_resize(self, size, partition): # don't do anything, just check cmd_path = requires("ntfsresize") cmd = "%s -n -f -s %dM %s" % (cmd_path, size, partition.path) return sysutils.run(cmd)
def check_resize(self, size, partition): # don't do anything, just check cmd_path = requires("ntfsresize") cmd = "%s -n -f -s %dM %s" % (cmd_path, size, partition.path) return sysutils.run(cmd)