I've try to find out the total size of my hard drive use df -h but it print size of each partition and require "sudo".
Is there any way to get total size of my hard drive use command line and not require root permission?
|
I've try to find out the total size of my hard drive use Is there any way to get total size of my hard drive use command line and not require root permission? | ||||
|
feedback
|
|
A hacky way is to bypass the need for
Please note that this might not be ideal, so your mileage may vary... | ||||
|
feedback
|
|
I'm not at my Linux box right now, but you could try:
or
which will also probably require a sudo. I haven't seen anywhere that df requires root. That's odd. | |||||||||
feedback
|
|
If you want to use that information in a script for example, using
might be easier than fdisk or hdparm as it only gives you the relevant information (just multiply by 512). However, it will also require sudo. You could of course change the configuration of sudo such that it allows to execute this specific command without asking for the password (I guess This would be done by adding the following line to
When you edit this file, be sure to use the command | ||||
|
feedback
|
|
You either have a bad install or an absurdly paranoid sysadmin. I've never heard of Anyhow, this will give you the total size of all disk partitions (first
or in GB:
| |||
|
feedback
|
But the size is in block-based unit Or you can try udisks
| ||||
|
feedback
|
dfis imprecise if the disk has unpartitioned space, not all partitions are mounted (e.g., some Windows partitions on the same drive) or some partitions are not mounted directly but indirectly through RAID, LVM or LUKS (encryption). It will also miss the swap partition(s). So I recommend not to usedffor finding out the HDD size. – Philipp Wendler Oct 28 '11 at 10:43