linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* About volume/disk blocks/size properties
@ 2011-01-08 12:53 José Félix Ontañón
  2011-01-08 17:26 ` Kay Sievers
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: José Félix Ontañón @ 2011-01-08 12:53 UTC (permalink / raw)
  To: linux-hotplug

Hello everybody,

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, but on the other hand you need root
privs to get this info for disk devices, am i wrong? I think udev
should, at least, export this properties making them available for
user space apps.

I've been looking for similar questions on the mail-list archives but
couldn't found anything related, so i'll be very glad if someone could
clarify. Thanks in advance.

-- 
http://fontanon.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: About volume/disk blocks/size properties
  2011-01-08 12:53 About volume/disk blocks/size properties José Félix Ontañón
@ 2011-01-08 17:26 ` Kay Sievers
  2011-01-09 23:07 ` José Félix Ontañón
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Kay Sievers @ 2011-01-08 17:26 UTC (permalink / raw)
  To: linux-hotplug

2011/1/8 José Félix Ontañón <felixonta@gmail.com>:
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: About volume/disk blocks/size properties
  2011-01-08 12:53 About volume/disk blocks/size properties José Félix Ontañón
  2011-01-08 17:26 ` Kay Sievers
@ 2011-01-09 23:07 ` José Félix Ontañón
  2011-01-10  0:44 ` Kay Sievers
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: José Félix Ontañón @ 2011-01-09 23:07 UTC (permalink / raw)
  To: linux-hotplug

El día 8 de enero de 2011 18:26, Kay Sievers <kay.sievers@vrfy.org> escribió:
> 2011/1/8 José Félix Ontañón <felixonta@gmail.com>:
>> 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 ??

Thanks!
-- 
http://fontanon.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: About volume/disk blocks/size properties
  2011-01-08 12:53 About volume/disk blocks/size properties José Félix Ontañón
  2011-01-08 17:26 ` Kay Sievers
  2011-01-09 23:07 ` José Félix Ontañón
@ 2011-01-10  0:44 ` Kay Sievers
  2011-01-19 13:38 ` Karel Zak
  2011-01-19 22:34 ` José Félix Ontañón
  4 siblings, 0 replies; 6+ messages in thread
From: Kay Sievers @ 2011-01-10  0:44 UTC (permalink / raw)
  To: linux-hotplug

2011/1/10 José Félix Ontañón <felixonta@gmail.com>:
> El día 8 de enero de 2011 18:26, Kay Sievers <kay.sievers@vrfy.org> escribió:

> It seems the size file give us the number of sectors, isn't?

Yeah.

> 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 ??

Internal kernel size value is always 512 bytes.

Kay

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: About volume/disk blocks/size properties
  2011-01-08 12:53 About volume/disk blocks/size properties José Félix Ontañón
                   ` (2 preceding siblings ...)
  2011-01-10  0:44 ` Kay Sievers
@ 2011-01-19 13:38 ` Karel Zak
  2011-01-19 22:34 ` José Félix Ontañón
  4 siblings, 0 replies; 6+ messages in thread
From: Karel Zak @ 2011-01-19 13:38 UTC (permalink / raw)
  To: linux-hotplug

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@vrfy.org> escribió:
> > 2011/1/8 José Félix Ontañón <felixonta@gmail.com>:
> >> 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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: About volume/disk blocks/size properties
  2011-01-08 12:53 About volume/disk blocks/size properties José Félix Ontañón
                   ` (3 preceding siblings ...)
  2011-01-19 13:38 ` Karel Zak
@ 2011-01-19 22:34 ` José Félix Ontañón
  4 siblings, 0 replies; 6+ messages in thread
From: José Félix Ontañón @ 2011-01-19 22:34 UTC (permalink / raw)
  To: linux-hotplug

El día 19 de enero de 2011 14:38, Karel Zak <kzak@redhat.com> 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@vrfy.org> escribió:
>> > 2011/1/8 José Félix Ontañón <felixonta@gmail.com>:
>> >> 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@redhat.com>
>  http://karelzak.blogspot.com
>



-- 
http://fontanon.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-01-19 22:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-08 12:53 About volume/disk blocks/size properties José Félix Ontañón
2011-01-08 17:26 ` Kay Sievers
2011-01-09 23:07 ` José Félix Ontañón
2011-01-10  0:44 ` Kay Sievers
2011-01-19 13:38 ` Karel Zak
2011-01-19 22:34 ` José Félix Ontañón

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).