Search code examples
linuxgoogle-cloud-platformlinux-disk-free

Filesystems, and quota for the home directory and /usr/local on the Google Cloud VM


I created a Debian VM on google cloud. Below is information from "df -h". What are those filesystems, such as tmpfs or /dev/sda1, mean? Any beginner-friendly reference for them? In particular, how much space can I use at my working directory "~", and how much space can I use in /usr/local (for installing software). Any idea?

zell@instance-1:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            1.8G     0  1.8G   0% /dev
tmpfs           371M  6.4M  365M   2% /run
/dev/sda1       9.8G  1.4G  7.9G  15% /
tmpfs           1.9G     0  1.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup

Solution

  • df -h 
    

    shows the amount of disk space used and available on Linux file systems. The command df stands for Disk Free and -h means human-readable form.

    You can also see information about a specific filesystem, as follows:

    df /dev/sda1
    

    From Documentation:

    Tmpfs is a file system which keeps all files in virtual memory. Everything in tmpfs is temporary in the sense that no files will be created on your hard drive. If you unmount a tmpfs instance, everything stored therein is lost.

    They can be mounted on different directories. For example, a tmpfs filesystem mounted at /dev/shm is used for the implementation of POSIX shared memory, an inter-process communication (IPC) where two or more processes may read from and write to the shared memory region, and POSIX semaphores, which allows processes and threads to sync their actions.


    From What does /dev/sda mean?:

    /dev/ is the part in the unix directory tree that contains all "device" files -- unix traditionally treats just about everything you can access as a file to read from or write to. Therefore, /dev/sda1 means the first partition on the first drive, and /dev/sda9 will mean the ninth partition on the first drive.

    Check out the link for more information.


    To display the amount of disk space used by the specified files and for each subdirectory, you can run the following command:

    du -h
    

    WHERE du stands for Disk Usage and -h means human-readable form.

    Optionally you can use the following command to display the amount of disk space used by a certain directory:

    du -h usr/local