Welcome to the Linux Foundation Forum!

Human-readable size format

Hello from France.

I just started LFS201 to prepare for the LFCS exam. I think there is an error in the PDF "Lab 2.1. Sizes of the Default Linux Directories". The -h option returns human-readable numbers in KiB, MiB or GiB noted K, M and G in Linux by default instead of KB, MB and GB as noted in the solution. But maybe I'm wrong.

I take this opportunity to ask a question about this lab: why not exclude the /tmp directory whose contents are usually placed in RAM and therefore do not participate in increasing the volume of data on the mass storage .

Alex

Comments

  • coop
    coop Posts: 916

    The /tmp directory is not generally stored in RAM and on limited memory machines this can be a very bad practice and cause failure. As far as I know, only Fedora puts /tmp in RAM and it is easy to turn off by doing systemctl mask tmp.mount and rebooting. All distros have their own philosophy about how to deal with /tmp. On Ubuntu it is wiped at every boot, on RHEL/CentOS systems files stay for a period of time (10 days or so) and if they are not used they disappear (tmpwatch)

    the Mib vs MB question is not important in this context and you may be right but I've never paid attention :)

  • Thank you for the clarification.

  • I just realized that I was taking a shortcut in my thinking. When I was reading that Ubuntu deletes the contents of /tmp on every reboot, to me it was because the directory was mounted in RAM which is false. To be precise, since Ubuntu 16.04, the deletion at each reboot is controlled by the file /usr/lib/tmpfiles.d/tmp.conf : "D /tmp 1777 root root -". Man tmpfiles.d to understand the syntax.

Categories

Upcoming Training