Partition names with Python

Erhan Ekici erhan at uzem.itu.edu.tr
Wed Jul 2 10:17:49 CEST 2003


Hi,

But some machines /proc/partition file is empty..
But /etc/fstab contain drives names..(sda1,sda2,cdrom,floopy etc)

For Example My Server(Slackware 9)'s /proc/partition file contain nothing.
I must take partition names on all Linux(Redhat,Mandrake,Slackware etc)..

Why do some machine's /proc/partition file contain nothing... 

Erhan,

Quoting John Hunter <jdhunter at ace.bsd.uchicago.edu>:

> >>>>> "Artur" == Artur M Piwko <pipen at beast_tu_kielce.pl> writes:
> 
>     Artur> And /proc/partitions.
> 
> Best yet!
> 
> import os
> fh = file('/proc/partitions')
> 
> fh.readline() # eat the header
> fh.readline() # eat the blank line
> 
> partitions = [line.split()[-1] for line in fh.readlines()]
> print partitions
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 


-- 

Erhan Ekici
ITU Center for Distance Learning
E-Mail : erhan at uzem.itu.edu.tr








More information about the Python-list mailing list