- def size(self):
- """Returns the "payload" size of the device.
-
- The size returned by this method is the size of the space occupied by
- the partitions (including the space before the first partition).
- """
-
- if self.parttype == 'msdos':
- dev = self.g.part_to_dev(self.root)
- last = self.g.part_list(dev)[-1]
- return last['part_end'] + 1
- elif self.parttype == 'gpt':
- ptable = GPTPartitionTable(self.device)
- return ptable.size()
- else:
- raise FatalError("Unsupported partition table type: %s" % parttype)