Easy way to detect hard drives and partitions in Linux

RunLevelZero Aiwass333 at gmail.com
Thu Jun 2 21:26:48 CEST 2005



Jeff Epler wrote:
> You're not going to find a single portable "unix" way of doing this.
> The format of /etc/fstab and /etc/mtab are pretty portable, but they
> only list mountable/mounted partitions, not all partitions.
>
> In addition to the linux possibilities mentioned in another reply, there
> is also /proc/partitions.  Finally, if you only want to recognize
> FDISK.EXE-type partitions (used by many types of Linux, though that
> seems to be changing in Fedora Core 4), it shouldn't be hard to write a
> Python program to read the partition table directly from the disk.  The
> details will be readily available online.
>
> Jeff

Well thanks for the responses and so quickly.  I'm very new to
programming and am not afraid to say it.  I'll see what I can come up
with.  at least this is a good start.

Thanks.




More information about the Python-list mailing list