I have already googled and found the following post

Linux disk space

In there, i use the following

df -hT /home | awk 'FNR == 2 {print $3 "B"}'

to get the full size of my linux machine disk.

Sadly, this one does not work on a machine that we use as a Virtual Machine farm (all VMs run on it)

i can get the disk size with

fdisk -l

Device           Start        End    Sectors  Size Type

/dev/md126p1      2048     247807     245760  120M EFI System

/dev/md126p2    247808     657407     409600  200M Microsoft basic data

/dev/md126p3    657408   39062495   38405088 18,3G Microsoft basic data

/dev/md126p4  39062784  101562607   62499824 29,8G Linux swap

/dev/md126p5 101562624 5567512319 5465949696  2,6T Linux LVM

From here you can read out that the full size is 2.6T (2.6TB aka 2600GB)

Are there any other way to get this? also, does someone already have a way to grep/cut this out quick?

  • There's not enough information. What linux distro are you using? What package manager do you have there?
    – holms
    Mar 26 '18 at 13:03
  • Debian. Different versions of it. No idea how to check the package mangers.
    – TheSebM8
    Mar 26 '18 at 13:09
  • And also, "this one does not work". What does not work? Which error are you getting?
    – dr_
    Mar 26 '18 at 13:10
  • It works but not how i want it to. It only shows me /home/ directory size which is right now 40GB. The whole host size is 2.6TB
    – TheSebM8
    Mar 26 '18 at 13:17
  • 2
    You're only seeing /home because you're asking to only see /home. Use df -hT to see sizes of all mounted partitions. Mar 26 '18 at 13:22
df -h /

will give you the size of the disk mounted as root, in human-easily-readable format. It's part of the coreutils package on RHEL/CentOS so I suppose it works on all distros.

  • Not what i can use, i already used df as noted above.
    – TheSebM8
    Mar 26 '18 at 13:08

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.