Re: About volume/disk blocks/size properties

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

 



El dÃa 19 de enero de 2011 14:38, Karel Zak <kzak@xxxxxxxxxx> escribiÃ:
> On Mon, Jan 10, 2011 at 12:07:41AM +0100, Josà FÃlix OntaÃÃn wrote:
>> El dÃa 8 de enero de 2011 18:26, Kay Sievers <kay.sievers@xxxxxxxx> escribiÃ:
>> > 2011/1/8 Josà FÃlix OntaÃÃn <felixonta@xxxxxxxxx>:
>> >> I wonder... are there any reasons for not being convenient to export
>> >> some properties refering the volume size of a disk device?
>> >> Although I'm concerned about the
>> >> don't-turning-udev-into-a-hal-like-system, I still perceiving the
>> >> volume.size or volume.block_size properties as very useful for user
>> >> space apps.
>> >>
>> >> On the one hand, it could be easy for user space apps to get the
>> >> size/blocks for partition devices,
>> >
>> > Â$ grep . /sys/class/block/*/size
>> > Â/sys/class/block/sda1/size:41943040
>> > Â/sys/class/block/sda2/size:41943040
>> > Â/sys/class/block/sda3/size:115343360
>> > Â/sys/class/block/sda4/size:50835456
>> > Â/sys/class/block/sda/size:250069680
>> > Â/sys/class/block/sr0/size:2097151
>> >
>> >> but on the other hand you need root
>> >> privs to get this info for disk devices, am i wrong?
>> >
>> > Everybody can do that.
>> >
>> > Kay
>> >
>>
>> Oh! Much better! Sorry for messing up.
>>
>> It seems the size file give us the number of sectors, isn't?
>> In order to get the bytes of the disk/partition ... is it right to
>> multiply /sys/block/<disk>/queue/logical_block_size times
>> /sys/block/<disk>/size ??
>
> ÂThe latest util-linux version (2.19-rc1) contains a new "lsblk" util,
> Âfor example:
>
> $ lsblk -b
> NAME Â Â Â Â Â Â Â Â MAJ:MIN RM Â Â Â Â SIZE RO MOUNTPOINT
> sda          Â8:0  Â0 100030242816 Â0
> ââsda1 Â Â Â Â Â Â Â Â 8:1 Â Â0 Â Â106896384 Â0
> ââsda2 Â Â Â Â Â Â Â Â 8:2 Â Â0 Â Â Â Â 1024 Â0
> ââsda3 Â Â Â Â Â Â Â Â 8:3 Â Â0 Â 2410007040 Â0 [SWAP]
> ââsda4 Â Â Â Â Â Â Â Â 8:4 Â Â0 Â81783959040 Â0 /
> ââsda5 Â Â Â Â Â Â Â Â 8:5 Â Â0 Â10742183424 Â0
> â ââkzak-home (dm-0) 253:0 Â Â0 Â10741655040 Â0 /home/kzak
> ââsda6 Â Â Â Â Â Â Â Â 8:6 Â Â0 Â 4984487424 Â0 /boot
>
> Âmore at http://karelzak.blogspot.com/2010/12/lsblk8.html
>
> Â ÂKarel

Thaks Karel, i'll check that improvement on util-linux for taking
ideas about how you access /proc information.

Cheers!

> --
> ÂKarel Zak Â<kzak@xxxxxxxxxx>
> Âhttp://karelzak.blogspot.com
>



-- 
http://fontanon.org
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux