Stat disk drives wihout lsblk?

Seeing through the wiki page of busybox, I see it supports df command to find disk usage.

You can try the below command.

df -h - Show free space on mounted file systems.

From the man page of busybox, they have provided examples of how to use the df command.

However, as @nwildner pointed out, the df will show storage on a mounted filesystem and not the schemes related to partitions. To find it out, you can check the below file.

cat /proc/partitions

As you had mentioned fdisk -l is not working the above file might contain the partition information.

Testing

fdisk -l produced the below output in my system.

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        9726    78019672+  8e  Linux LVM

Now, I can get the partition information if I use cat /proc/partitions. The output is,

major minor  #blocks  name

   8     0   78125000 sda
   8     1     104391 sda1
   8     2   78019672 sda2
 253     0   78019156 dm-0
 253     1   72581120 dm-1
 253     2    5406720 dm-2

The major number is 8 that indicates it to be a disk device. The minor ones are your partitions on the same device. 0 is the entire disk, 1 is the primary, 2 is extended and 5 is logical partition. The rest is of course block size and name of disk/partition.

Not sure if an intelligent suggestion, but did you try sudo fdisk -l to see if it is working?

EDIT#1

You can also run $ df -T. This is another command that does not require super user privileges to execute. However, this will report for every mount point.

Another command that can come handy is # file -sL /dev/sdXY. This has one downside in that it does not work with the full block device. Requires the exact device to be passed. The output is quite neat though:

References

How to determine the filesystem of an unmounted device?


Looks like the other answerers didn't actually test on BusyBox. Here are the only commands that worked on the BusyBox in my initramfs:

  • cat /proc/partitions shows the disk and partition sizes in blocks (KiB)

  • blkid shows the partition labels, UUIDs, and types (EXT4, NTFS, etc)