dcantrell / pyparted

Python bindings for GNU parted (libparted)
GNU General Public License v2.0
85 stars 42 forks source link

parted.sizeToSectors() rounds sizes down #35

Closed sil2100 closed 7 years ago

sil2100 commented 7 years ago

The code for sizeToSectors() in pyparted is:

bytes_ * __exponents[unit] // sector_size

This means that the sizes are rounded down whenever the size is not a multiply of the sector size. This sounds like a really bad idea as it can mean that the partition we end up creating can be smaller than the contents we want to fit (especially that the method name is sizeToSectors). I think the default should be to round the size up.