how to get partition information of a hard disk with python
as at sci.fi
Thu Sep 30 10:41:48 CEST 2010
Nobody <nobody at nowhere.com> writes:
> On Wed, 22 Sep 2010 00:31:04 +0200, Hellmut Weber wrote:
>> I'm looking for a possibility to access the partiton inforamtion of a
>> hard disk of my computer from within a python program.
> Have you considered parsing /proc/partitions?
One could also just read the partition table directly, it's on the
first sector usually. (Assuming a PC without a GUID partition
table...) The partition table is just 64 bytes at offset 446 into the
sector. In unixlikes you can just open the disk with file.open()...
Then again, unixlikes other than Linux have somewhat different ideas
More information about the Python-list