how to get partition information of a hard disk with python

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Sun Oct 3 03:19:06 EDT 2010


In message <vg31v8bfws3.fsf at pepper.modeemi.fi>, Anssi Saari wrote:

> Nobody <nobody at nowhere.com> writes:
> 
>> Have you considered parsing /proc/partitions?
> 
> One could also just read the partition table directly, it's on the
> first sector usually.

The Linux kernel includes built-in support for something close to two dozen 
different partition formats, from the common ones like MS-DOS, Solaris, SGI, 
Ultrix, EFI and BSD on down. Why reinvent parts of that when you can get it 
all for free?



More information about the Python-list mailing list