3

I am using df -h to get my disk space and the results are:

Filesystem     Size       Used     Avail  Use%   Mounted on
udev            2.0G       4.0K     2.0G   1%     /dev
tmpfs           396M       436K     395M   1%     /run
/dev/vda1       59G        3.6G     53G    7%     /
none            4.0K       0        4.0K   0%     /sys/fs/cgroup
none            5.0M       0        5.0M   0%     /run/lock
none            2.0G       12K      2.0G   1%     /run/shm
none            100M       12K      100M   1%     /run/user

and when I use sudo fdisk -l | grep Disk , I get:

Disk /dev/vda: 64.4 GB, 64424509440 bytes
Disk /dev/sda: 107.4 GB, 107374182400 bytes

Why doesn't df -h doesn't show space on /dev/sda? How can I see my total Disk space?

  • 2
    Does /dev/sda have any mounted partitions? – muru Oct 24 '16 at 10:09
  • Please show the list of partitions from fdisk, your grep is too mean. – Melebius Oct 24 '16 at 10:17
9

df only cares about (mounted) filesystem, not any raw disk/partition.

If you follow the standard procedure to make a raw disk available to be used by userspace processes i.e. partition the device /dev/sda, and then format them using desired filesystem, and mount the filesystems, then the filesystems would obviously be shown by df.

| improve this answer | |
  • hmm....I can see now partition is not mounted.I am getting a message Disk /dev/sda doesn't contain a valid partition table. Let me see how can I add it to my filesystem – Prashant Prabhakar Singh Oct 24 '16 at 10:24
  • Is there any link avilable for how can I mount this sda partition? – Prashant Prabhakar Singh Oct 24 '16 at 10:39
  • just run udisksctl mount -b /dev/sda1 That'll do everything automatically for you and tell you which folder it's mounted to, which typically is under /media/username/partitionID – Sergiy Kolodyazhnyy Oct 24 '16 at 10:42
  • I am getting Error looking up object for device /dev/sda1 – Prashant Prabhakar Singh Oct 24 '16 at 12:33
  • @PrashantPrabhakarSingh what does lsblk tell you ? is there only /dev/sda or are there devices with numbers ? have you tried the command with /dev/sda ? – Sergiy Kolodyazhnyy Oct 24 '16 at 13:59
0

To know the total disk space you could do something like this:

dmesg | grep sda

On my system it prints several lines. The interesting one is:

[19266.419331] sd 0:0:0:0: [sda] 272629760 512-byte logical blocks: (139 GB/130 GiB)

In this case, the size is 139 GB.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.