in reply to get the size of a special device (drive)

You could also parse the output of good ol' fdisk — e.g. fdisk -l -u /dev/hda  (-u to display the info in units of sectors (the size of which it'll tell you, too)). Problem might be (depending on context) that it'll need to be run as root...