The File System

The Linux (and UNIX) file system is a hierarchical structure of files and directories (i.e. folders) that make up a Linux operating system.

In Linux, everything is a file, unlike Microsoft Windows where many other object types can either be a physical device, and inter-process communications are done by kernel calls.

If you prefer a video, this one is a good crash course.

The File System Hierarchy

The file system hierarchy is a set of directories that appear under the root directory /. They not only contain normal files, but also physical devices, virtual devices, and various other special files that control the system itself.

The directory structure is as follows:

DirectoryDescription
/The root directory with the all the other directories and files.
/binExecutables and command binares required for a functioning system.
/bootThe bootloader and files used during early boot process. May usually be in a separate partition.
/devSpecial device files for various purposes (/dev/sda for a SATA drive, /dev/null for blank data, /dev/random for pseudo-random data, /dev/tty for terminal sessions, etc).
/etcSystem-wide settings and configuration files.
/homeUser data.
/libLibraries required for executables in /bin to function. May be also named /lib<arch> for multi-architecture support.
/mediaMount points for removable media, such as USB drives, SD cards, etc.
/mntTemporary mount points for mounting devices.
/optOptional packages that may be installed by the user.
/procProcess data and kernel information for inter-process communication managed by the kernel.
/rootUser data for the root user.
/sbinExecutables for system tasks.
/srvShared service data used by server processes, such as web servers and NAS/File servers.
/tmpTemporary data.
/usrShared application data used by all users.
/varVariable data used by system processes.

The Home Directory

The home folder is the place where all your personal data is stored. It is a directory that is located under the /home directory, followed by the username. It is similar to the Users folder in Windows.

In Linux, the home folder is usually more extensively used than in Windows, as it stores all user-specific data and app settings. The system folders are only used when one wants to make system-wide changes.

If an app you don’t know asks you for your password or root access, It may be trying to compromise your system. Cases like this are usually uncommon on Linux, but you should be aware of it.

Security

Ultramarine Linux uses SELinux, a software that implements Mandatory Access Control. This prevents applications (and users) from accessing files they shouldn’t be able to.

Users will usually be required to have root access to modify system files, and even then, SELinux may prevent you from doing so unless you have set the correct contexts for the files.

By default, SELinux is in “Enforcing” mode, which means that it will prevent you from modifying system files unless you have the correct permissions. This shouldn’t cause any issues. If you would like to disable SELinux you can runsudo setenforce 0. We don’t recommend this as it makes your system less secure.

Learn more about SELinux →

Learn more about Permissions →

Virtual Memory

Virtual memory is a feature in Linux and other operating systems that allows the system to use a portion of the disk as RAM. This is useful when the system runs out of RAM and needs to use the disk as a temporary storage for data.

On Windows, this is called a “Page file”, and on Linux, it is called a “Swap file”. The swap file is usually located at /swapfile or as a dedicated partition on the disk.

Swap comes with many issues, for example, it can reduce the lifespan of lower-cost SSDs, and may be too slow on hard drives. To combat this Ultramarine uses memory compression (zram specifically).

By default, we match the amount of physical memory you have. (Which is the maximum)

Although this may sound magical, it does come at the cost of your CPU working a little bit harder. Luckily this is not very noticeable on modern computers.

Learn more about zram →

File system formats

Ultramarine Linux supports a wide variety of file systems, and can be configured to use any of them during installation.

It currently supports most file systems that are supported by the Linux kernel, including:

  • ext2, ext3, ext4
  • Btrfs
  • XFS
  • NTFS
  • FAT32

And extra file system drivers can be installed, such as:

  • exFAT
  • ZFS

The Ultramarine Linux installer will be configured to use the BTRFS file system by default, as it is the most modern file system that is supported by the Linux kernel, and has many features that are useful for desktop users, such as snapshots, virtual volumes, journalling, error correction and compression.

By default, it will use up all the available space on the disk. It uses a small portion of the spaces for the EFI bootloader partition, and create a BTRFS JBOD array using the rest of all the available space on all selected disks. It then creates 2 subvolumes, one for the root directory /, and one for the home directory /home, which will share the same space but have different filesystem settings.

So unless specified otherwise, the installer will use all your disks to create a JBOD (spanned) array, which may be undesirable if you do not want to risk losing all your data if one of the disks fail.

Most server installations will use XFS or ZFS, as they have better performance and reliability for servers, and are more suitable for RAID arrays.

Remote Filesystems

Ultramarine Linux can also mount remote file systems from a remote server or NAS, using the NFS, (S)FTP, SMB, and WebDAV protocols.

← Back To: Concepts

Next Up: Device Files →