[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to get the size of a disk partition from user space?
On 5/19/08, Michael Blizek <michi1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> 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
> --
it display the data in which unit?
On my system, the output is as follows:-
adil@localhost:~> df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 10G 4.7G 5.3G 47% /
udev 466M 208K 466M 1% /dev
/dev/sda5 43G 14G 27G 35% /home
/dev/sda7 20G 7.1G 12G 39% /home1
adil@localhost:~> cat /sys/block/sda/sda1/size
20900502
adil@localhost:~> cat /sys/block/sda/sda5/size
91570437
These outputs are not matching with the first one.
Am I missing anything??
> programing a layer 3+4 network protocol for mesh networks
> see http://michaelblizek.twilightparadox.com
>
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ