Re: how to get the size of a disk partition from user space?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 19 May 2008, Michael Blizek wrote:

> On 07:55 Sun 18 May     , Robert P. J. Day wrote:
> >
> >   possibly slightly off-topic, but i've been handed (not at hand at
> > the moment, though) an embedded system running 2.4.26, which has a
> > bunch of flash-based partitions corresponding to the device files
> > /dev/scsi/host-?/bus0/target0/lun0/part-?.
> >
> >   what i want is a quick way to determine the size in bytes of those
> > partitions.  will there be entries for them in /proc/partitions?  is
> > there a better way?  they won't necessarily be mounted; in fact, they
> > probably won't be.  thoughts?  thanks.
>
> cat /sys/block/hda/hda1/size
> 	-Michi

sadly, on this system, there is no /sys filesystem.  but i got what i
needed by just opening the device, reading the boot sector and parsing
the partition table.  it seemed like the simplest thing to do.

rday
--

========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
    Have classroom, will lecture.

http://crashcourse.ca                          Waterloo, Ontario, CANADA
========================================================================

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux