Changes

Jump to: navigation, search

OPS435 Python Assignment 2 C

213 bytes added, 08:55, 3 April 2018
Sample Python codes
== Module name, function names, function parameter(s) and return values ==
Name your python module as "partinfo.py". The module should contains at least the following 3 functions:
* <code>part_scheme() </code> - which when called with a valid physical storage device name, will return the partition scheme used on the device. The return returned value should only be
** None - no valid partition scheme found on the device
** MBR - MBR partitions is/are found on the device
** GPT - GUID partitions is/are found on the device
* <code>mbr_part() </code> - which when called with a valid physical storage device name, will return all the partitions (primary, extended, and logical) found on the device. Each partition information return returned must contain the following fields:
** partition number
** partition flag (bootable or not)
** start sector number (in LBA mode)
** size of partition in sectors
* <code>gpt_part() </code> - which when called with a valid physical storage device name, will return all the partitions found on the device. Each partition information return returned must contain the following fields:
** Partition type GUID
** Unique partition GUID
== Sample Python codes ==
The following sample python code reads and display displays primary partition partitions on a given physical storage device with MBR partition scheme:. Please note that this python script does not check for extended partition and does not try to extract the information for logical partitions even they exist.
<pre>
#! /usr/bin/python
# read and display primary partition info
# on a physical disk or disk image
#
1,760
edits

Navigation menu