Personally, I'd go with `du -h` or `du -B 1` (for bytes)
But AFAICT du is for mounted filesystems. He was asking about raw devices. I suppose the answer is somewhere in the docs for sysfs. (The kernel's?)
| [reply] [d/l] [select] |
True enough, but I still can't seem to find any docs on /sys/block/*/size.
A simple grep -ri sys .|grep -i size (in the /usr/src/linux/Documentation dir) doesn't seem to turn up anything useful.
update: Also, the /sys/bock/*/size entries seem to refer to full drive sizes. There's nothing in there referring to partitions. That might or might not be interesting to the OP.
| [reply] [d/l] |
True enough, but I still can't seem to find any docs on /sys/block/*/size.
Well, this is obviously hitting the limits of PerlMonks: there's no reason why some monks here may not also be Linux experts, but I'm sure one would have more luck asking in some specific forum, ng or ml.
Also, the /sys/bock/*/size entries seem to refer to full drive sizes. There's nothing in there referring to partitions. That might or might not be interesting to the OP.
This doesn't appear to be the case in at least a system I'm trying:
| [reply] [d/l] |
unfortunately du requires the filesystem to be mounted, not an option in this case :-( | [reply] |