harddisk and partitions

harddisk and partitions

Post by MESMEUR Philipp » Wed, 08 Nov 2000 04:00:00



Hello, I'm looking for a way to get the list of the hard-drives an the
list for all the partitions in each hard-disk. I think the is a system
call to to this.

Can you please help me. Thanks

--

--------------------------------------------------------
                Oce-Industries SA
                1, rue Jean Lemoine
                94015 Creteil cedex France                
                phone: 33-1-48988000  fax: 33-1-48985450
--------------------------------------------------------

 
 
 

harddisk and partitions

Post by Tux » Wed, 08 Nov 2000 04:00:00



> Hello, I'm looking for a way to get the list of the hard-drives an the
> list for all the partitions in each hard-disk. I think the is a system
> call to to this.

> Can you please help me. Thanks

> --

> --------------------------------------------------------
>                 Oce-Industries SA
>                 1, rue Jean Lemoine
>                 94015 Creteil cedex France
>                 phone: 33-1-48988000  fax: 33-1-48985450
> --------------------------------------------------------

What about "fdisk -l" ?

Tux

 
 
 

harddisk and partitions

Post by Philip Armstro » Wed, 08 Nov 2000 04:00:00




>> Hello, I'm looking for a way to get the list of the hard-drives an the
>> list for all the partitions in each hard-disk. I think the is a system
>> call to to this.
>What about "fdisk -l" ?

Or cat /proc/partitions ?

Phil

--
http://www.kantaka.co.uk/ .oOo. public key: http://www.kantaka.co.uk/gpg.txt

 
 
 

harddisk and partitions

Post by MESMEUR Philipp » Thu, 09 Nov 2000 04:00:00





> >> Hello, I'm looking for a way to get the list of the hard-drives an the
> >> list for all the partitions in each hard-disk. I think the is a system
> >> call to to this.
> >What about "fdisk -l" ?

> Or cat /proc/partitions ?

yes but I would like a function to do this (if there isn't, I
will code it)

Quote:> Phil

> --
> http://www.kantaka.co.uk/ .oOo. public key: http://www.kantaka.co.uk/gpg.txt

--

--------------------------------------------------------
                Oce-Industries SA
                1, rue Jean Lemoine
                94015 Creteil cedex France                
                phone: 33-1-48988000  fax: 33-1-48985450
--------------------------------------------------------

 
 
 

harddisk and partitions

Post by Josef Moeller » Thu, 09 Nov 2000 04:00:00






> > >> Hello, I'm looking for a way to get the list of the hard-drives an the
> > >> list for all the partitions in each hard-disk. I think the is a system
> > >> call to to this.
> > >What about "fdisk -l" ?

> > Or cat /proc/partitions ?

> yes but I would like a function to do this (if there isn't, I
> will code it)

??? You want to write a function to retrieve information which is
already there ???
Hey, this is Linux, not any other OS!

--
Josef M?llers (Pinguinpfleger bei FSC)
        If failure had no penalty success would not be a prize (T.  Pratchett)

 
 
 

harddisk and partitions

Post by MESMEUR Philipp » Thu, 09 Nov 2000 04:00:00







> > > >> Hello, I'm looking for a way to get the list of the hard-drives an the
> > > >> list for all the partitions in each hard-disk. I think the is a system
> > > >> call to to this.
> > > >What about "fdisk -l" ?

> > > Or cat /proc/partitions ?

> > yes but I would like a function to do this (if there isn't, I
> > will code it)

> ??? You want to write a function to retrieve information which is
> already there ???
> Hey, this is Linux, not any other OS!

I want to write a C-Program that needs to know all hard-disk on the
current system and all partitions in each hard-disk;
I can write a function that reads /proc/partitions or maybe, if it
exists, I can use a function that does the same.

Sorry if it was not clear.
thanks to answer me

Quote:> --
> Josef M?llers (Pinguinpfleger bei FSC)
>         If failure had no penalty success would not be a prize (T.  Pratchett)

--

--------------------------------------------------------
                Oce-Industries SA
                1, rue Jean Lemoine
                94015 Creteil cedex France                
                phone: 33-1-48988000  fax: 33-1-48985450
--------------------------------------------------------

 
 
 

harddisk and partitions

Post by George MacDonal » Thu, 09 Nov 2000 04:00:00








> > > > >> Hello, I'm looking for a way to get the list of the hard-drives an the
> > > > >> list for all the partitions in each hard-disk. I think the is a system
> > > > >> call to to this.
> > > > >What about "fdisk -l" ?

> > > > Or cat /proc/partitions ?

> > > yes but I would like a function to do this (if there isn't, I
> > > will code it)

> > ??? You want to write a function to retrieve information which is
> > already there ???
> > Hey, this is Linux, not any other OS!

> I want to write a C-Program that needs to know all hard-disk on the
> current system and all partitions in each hard-disk;
> I can write a function that reads /proc/partitions or maybe, if it
> exists, I can use a function that does the same.

> Sorry if it was not clear.
> thanks to answer me

 fp = popen("cat /proc/partitions", "r" );

Now can you do 3D pie's with wedgies?

--
We stand on the shoulders of those giants who coded before.
Build a good layer, stand strong, and prepare for the next wave.
Guide those who come after you, give them your shoulder, lend them your code.

 
 
 

harddisk and partitions

Post by Kasper Dupon » Fri, 10 Nov 2000 04:00:00




[...]

> I want to write a C-Program that needs to know all hard-disk on the
> current system and all partitions in each hard-disk;
> I can write a function that reads /proc/partitions or maybe, if it
> exists, I can use a function that does the same.

> Sorry if it was not clear.
> thanks to answer me

Reading /proc/partitions probably is the easiest way to get
the information. There probably exist code to parse this file,
but finding it might not be easy.

Using fdisk -l does not work unless you are root, and might be
less portable than using /proc/partitions.

--
Kasper Dupont

 
 
 

harddisk and partitions

Post by Ken Wilso » Sat, 27 Jan 2001 06:08:15





> > I want to write a C-Program that needs to know all hard-disk on the
> > current system and all partitions in each hard-disk;
> > I can write a function that reads /proc/partitions or maybe, if it
> > exists, I can use a function that does the same.

> > Sorry if it was not clear.
> > thanks to answer me

>  fp = popen("cat /proc/partitions", "r" );

> Now can you do 3D pie's with wedgies?

If I need to find out characteristics of all partitions: active, bootable,
file type,
primary, logical...  Is there any system calls, APIs or ioctl()s available?
How
does cfdisk do it?
 
 
 

harddisk and partitions

Post by phil-news-nos.. » Sat, 27 Jan 2001 12:32:53





|> >

|> > >
|> >
|> > I want to write a C-Program that needs to know all hard-disk on the
|> > current system and all partitions in each hard-disk;
|> > I can write a function that reads /proc/partitions or maybe, if it
|> > exists, I can use a function that does the same.
|> >
|> > Sorry if it was not clear.
|> > thanks to answer me
|>
|>  fp = popen("cat /proc/partitions", "r" );
|>
|> Now can you do 3D pie's with wedgies?
|>
|
| If I need to find out characteristics of all partitions: active, bootable,
| file type,
| primary, logical...  Is there any system calls, APIs or ioctl()s available?
| How
| does cfdisk do it?

It reads the device directly.  Start with the MBR, then based on what
is in there, you mean need to read other blocks, including interpreting
them in different ways (e.g. BSD partitions should have a disklabel).

If you need to find out what the kernel's take on the partitions is,
then hopefully some ioctl() exists for your needs, or /proc/partitions
as what you need to know.

--
-----------------------------------------------------------------
| Phil Howard - KA9WGN |   Dallas   | http://linuxhomepage.com/ |

-----------------------------------------------------------------