Difference between revisions of "OPS435 Python Assignment 2 C"
(→Overview) |
|||
Line 1: | Line 1: | ||
[[Category:OPS435-Python]][[Category:rchan]] | [[Category:OPS435-Python]][[Category:rchan]] | ||
− | |||
= Overview = | = Overview = | ||
In order to use a physical storage device (e.g. Hard Disk, USB Flash memeory, SSD, etc.), the first step is to create partition(s) on it. There many different ways to partition a physical storage device. The two most common partition schemes used on Intel based micro-computer systems are MBR and GPT. Detail about the MBR partition scheme can be found [https://en.wikipedia.org/wiki/Master_boot_record here], and GPT partition scheme can be found at [https://en.wikipedia.org/wiki/GUID_Partition_Table]. | In order to use a physical storage device (e.g. Hard Disk, USB Flash memeory, SSD, etc.), the first step is to create partition(s) on it. There many different ways to partition a physical storage device. The two most common partition schemes used on Intel based micro-computer systems are MBR and GPT. Detail about the MBR partition scheme can be found [https://en.wikipedia.org/wiki/Master_boot_record here], and GPT partition scheme can be found at [https://en.wikipedia.org/wiki/GUID_Partition_Table]. | ||
Line 6: | Line 5: | ||
On most Linux systems, fdisk or parted can be used to create, view, and manage MBR and GPT partition. | On most Linux systems, fdisk or parted can be used to create, view, and manage MBR and GPT partition. | ||
− | The task for this assignment is to write a python module which contains the following functions: | + | The task for this assignment is to write a python module named "partinfo.py", which contains at least three functions: part_scheme(), mbr_part(), gpt_part(). |
− | * part_scheme() - which when called with a valid physical storage device name, will return the partition scheme used on the device. The return value should only be | + | |
− | * mbr_part() - which when called with a valid physical storage device name, will return all the partitions (primary, extended, and logical) found on the device. | + | |
+ | = Instruction = | ||
+ | == 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: | ||
+ | * part_scheme() - which when called with a valid physical storage device name, will return the partition scheme used on the device. The return 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 | ||
+ | * mbr_part() - 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 must contain the following fields: | ||
+ | ** partition number | ||
+ | ** partition flag (bootable or not) | ||
+ | ** partition type | ||
+ | ** start sector number (in LBA mode) | ||
+ | ** size of partition in sectors | ||
* gpt_part() - which when called with a valid physical storage device name, will return all the partitions found on the device. | * gpt_part() - which when called with a valid physical storage device name, will return all the partitions found on the device. | ||
− | |||
= Resources = | = Resources = | ||
* [https://en.wikipedia.org/wiki/Master_boot_record Master Boot Record - 4 partition entries] | * [https://en.wikipedia.org/wiki/Master_boot_record Master Boot Record - 4 partition entries] | ||
* [https://en.wikipedia.org/wiki/Extended_boot_record Extended partition and logical partitions] | * [https://en.wikipedia.org/wiki/Extended_boot_record Extended partition and logical partitions] | ||
* [https://en.wikipedia.org/wiki/GUID_Partition_Table GPT partitions] | * [https://en.wikipedia.org/wiki/GUID_Partition_Table GPT partitions] |
Revision as of 23:42, 2 April 2018
Contents
Overview
In order to use a physical storage device (e.g. Hard Disk, USB Flash memeory, SSD, etc.), the first step is to create partition(s) on it. There many different ways to partition a physical storage device. The two most common partition schemes used on Intel based micro-computer systems are MBR and GPT. Detail about the MBR partition scheme can be found here, and GPT partition scheme can be found at [1].
On most Linux systems, fdisk or parted can be used to create, view, and manage MBR and GPT partition.
The task for this assignment is to write a python module named "partinfo.py", which contains at least three functions: part_scheme(), mbr_part(), gpt_part().
Instruction
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:
- part_scheme() - which when called with a valid physical storage device name, will return the partition scheme used on the device. The return 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
- mbr_part() - 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 must contain the following fields:
- partition number
- partition flag (bootable or not)
- partition type
- start sector number (in LBA mode)
- size of partition in sectors
- gpt_part() - which when called with a valid physical storage device name, will return all the partitions found on the device.