[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Free space after partitioning



Hello,

I am trying to use pyanaconda.storage to get overview of installed
storage facilities and I have troubles counting free space on a disk.

Consider a (virtual) disk with 10 partitions, created by Anaconda (code
is below). pyanaconda.storage.partitioning.getFreeRegions([disk]) returns:

parted.Geometry instance --
  start: 63  end: 2047  length: 1985
-> the first sector is MBR. Why there are additional 62 sectors skipped
before the first free region? Is it because of alignment rules?
-> why Anaconda leaves the first megabyte free? Boot loader/grub? I did
not request any.

The rest of primary partitions are fine, without any gaps. Logical
partitions are quite different:

  start: 63551  end: 64259  length: 709
This free region is at the beginning of the extended partition. The
extended partition starts at sector 63488 and the first logical
partition starts at 67584.
-> Why there is a free space at all? I did not request any.
-> What are 3325 sectors between the free space end and the first
logical partition start? I know, there is one sector for logical
partition metadata, but 1.6MB, which is not part of any partition nor
free space region, seems too much to me.
-> Similarly, what are 63 sectors between the extended partition start
and the free space start? 1 sector is for logical partition metadata,
but the rest?

  start: 110592  end: 112454  length: 1863
This is a free space between two logical partitions.
-> Again, why is the free region here? And there are 186 'hidden'
sectors between this free space end and start of the next logical partition.

If the alignment to cylinder boundary is cause of these weird numbers,
can I turn the alignment off in pyanaconda.storage? The numbers
reported by disks are completely artificial anyway these days.

Thanks in advance for any partitioning insight.

Jan


Gory details
------------
Sample code to create 10 partitions:
<initialization omitted>
disk = storage.devicetree.getDeviceByName('sda')
for i in range(10):
    part = storage.newPartition(disks=[disk], size=10)
    storage.createDevice(part)
pyanaconda.storage.partitioning.doPartitioning(storage=storage)
storage.devicetree.processActions(dryRun=False)


complete print of pyanaconda.storage.partitioning.getFreeRegions([disk]):
parted.Geometry instance --
  start: 63  end: 2047  length: 1985
  device: <parted.device.Device object at 0x1efa6d0>  PedGeometry:
<_ped.Geometry object at 0x1efa690>
parted.Geometry instance --
  start: 63551  end: 64259  length: 709
  device: <parted.device.Device object at 0x1efa710>  PedGeometry:
<_ped.Geometry object at 0x1efa4d0>
parted.Geometry instance --
  start: 110592  end: 112454  length: 1863
  device: <parted.device.Device object at 0x1efa190>  PedGeometry:
<_ped.Geometry object at 0x1efa650>
parted.Geometry instance --
  start: 223232  end: 2097151  length: 1873920
  device: <parted.device.Device object at 0x1efab10>  PedGeometry:
<_ped.Geometry object at 0x1efa0d0>


fdisk output:
Disk /dev/sda: 1073 MB, 1073741824 bytes
34 heads, 61 sectors/track, 1011 cylinders, total 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc9797763

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048       22527       10240   83  Linux
/dev/sda2           22528       43007       10240   83  Linux
/dev/sda3           43008       63487       10240   83  Linux
/dev/sda4           63488     2097151     1016832    5  Extended
/dev/sda5           67584       88063       10240   83  Linux
/dev/sda6           90112      110591       10240   83  Linux
/dev/sda7          112640      133119       10240   83  Linux
/dev/sda8          135168      155647       10240   83  Linux
/dev/sda9          157696      178175       10240   83  Linux
/dev/sda10         180224      200703       10240   83  Linux
/dev/sda11         202752      223231       10240   83  Linux


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]