Ubuntu: Understanding hard drive space



Question:

I am trying to understand how to see the total size of my hard drive & how much is left. It was recommended on various searches to use the command below

 df -h  Filesystem      Size  Used Avail Use% Mounted on  udev            7.8G     0  7.8G   0% /dev  tmpfs           1.6G  9.6M  1.6G   1% /run  /dev/sda1       219G   29G  180G  14% /  tmpfs           7.8G   18M  7.8G   1% /dev/shm  tmpfs           5.0M  4.0K  5.0M   1% /run/lock  tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup  cgmfs           100K     0  100K   0% /run/cgmanager/fs  tmpfs           1.6G   64K  1.6G   1% /run/user/1000  

However I don't understand any of these directories. I mean what are they, are these all directories or partitions or what? And why do they appear under "mounted on"? How does that bit work. I assume the /dev/sda1 is my solid state drive? So now if I install applications, which one of these directories does my software get installed into? I assume it just gets installs in the / directory (I haven't even got a clue what the / directory is). Can someone explain what the other directories are and what they are used for?


Solution:1

If you run df -h you'll get the result of your HDD with a list of additional lines. The most, you should mention the lines that start with /dev/sda those are parts of your HDD as stated you can also check your layout with lsblk and there's one thing if you run sudo parted -l the results will be different from df -h and lsblk about disk capacity and also means about free space indeed.

sudo parted -l will show you the exact capacity of your HDD. Why do the results differ? Take a look at tune2fs, by default Linux systems reserve about 5% of space on each partition, you can run:

sudo tune2fs -l /dev/sda1 | grep -i reserved  

This will show you your reserved blocks count, thus for example if you run:

sudo tune2fs -m 3% /dev/sda1  

Which means to reserve 3% on the partition instead of 5% which will encrease your HDD space. For example if you have a seperate Home or media partition where you keep only music and videos you can set its value to 1% or even 0% reserved to have a complete space available for the data.


Solution:2

So according to your post, nobody can tell you, on which device the partitions are located.

It looks like your system is using one partition for both system and home directory, so the only interesting line is

Filesystem      Size  Used Avail Use% Mounted on  /dev/sda1       219G   29G  180G  14% /  

So the size of this partition is 219G, 29G are used, and 180G are available.


Solution:3

The list is various directories that are mounted to different filesystems. Most of them are tmpfs filesystems, which is like a ramdisk. They only hold temporary data while the system is running and are not stored anywhere on disk. Your root directory is mounted to /dev/sda1, which is the first partition on your primary hard disk.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »