w3resource

File system

File system

A filesystem is a permanent storage for containing data. Any non-volatile storage device like hard disk, usb etc has a filesystem in place, on top of which data is stored.

While installing Linux, you may opt for either EXT4 or EXT3 file system.

Ext3

A journaling filesystem: logs changes in a journal to increase reliability in case of power failure or system crash.

ext2

Not as fast as others, like JFS, ReiserFS and XFS, but wins in CPU utilization, reliability, and testing base.

Ext3 file limits

The following table shows file limits of a EXT3 files system.

Block size Max file size Max filesystem size
1 KiB 16 GiB <2 TiB
2 KiB 256 GiB <4 TiB
4 KiB 2 TiB <8 TiB
8 KiB[limits 1] 2 TiB <16 TiB

Ext3 levels of journaling

  • Journal
    • Lowest risk, slowest
    • Metadata and files are written to the journal before being committed.
  • Ordered (default)
    • Medium risk, medium speed
    • Metadata is written to the journal only - ext3 guarantees file contents are written to disk before marked as committed in the journal. Beware of "intermediate state" problem!
  • Writeback
    • Highest risk, fastest
    • Metadata is written in a journal, no guarantee for file contents.

Ext4

EXT4 is an advanced file system supported from Ubuntu 9.04. This filesystem supports 64-bit storage limits, columns up to 1 exabytes and you may store files up to 16 terabytes.

Moreover, it supports improved large file performance and reduced fragmentation which in turn enhances performance.

  • Adds 64-bit storage limits.
  • Volumes up to 1 exabyte. Files up to 16 terabytes.
  • Improved large file performance and reduced fragmentation.
  • Backward compatible with ext2 and 3.
  • Journal checksumming (not present in ext3).
  • Online defragmentation.
  • Timestamps in nanoseconds.

If we compare both of the above-mentioned files systems, then you will find that EXT4 has some more advanced features than it's older counter part. But at the same time, EXT3 is lighter than EXT4 and thus faster than that of a EXT4. But keeping the high amount of RAM used nowadays in even Desktop Computers that speed issues have become almost negligible. So, it is recommended that you use EXT4 for latest versions of Linux installations.

Files and directories

Filesystems store data in files and directories. Filesystems are stored in disk partitions. You can configure partitions any way you like, but something like this is advisable:

Usually, when you install Linux, it offers you options for creating various partitions to store a different kind of files, both system and user generated. But if you go with the default, Linux has got pre-defined set of directories and files which are used to store various kind of data, The following table shows which data is stored in which file.

Partition
Purpose
/usr This is where most executable binaries, the kernel source tree and much documentation go.
/var var directory is used mainly for different log files. Log files are very important for troubleshooting and monitoring. For example, if you got some .This is where spool directories such as those for mail and printing go. In addition, it contains the error log directory
/tmp This is where most temporary data file stored by apps.
/boot This is where your kernel images and boot loader configuration go.
/home This is where user home directories go.

fstab: static fs info

fstab is a text file that contains filesystem information

cat /etc/fstab

static-fs-info

df: Partition utilization

df stands for "disk free"

df -h

df-partition-utilization

Mount points

The mount command attaches a filesystem to a mount point

mount

mount-points

Remount /usr in read only:

mount -o remount, ro /usr
remount

In continuation after the press enter key of mount -o remount command show these result

remount1

Mount all fs in /etc/fstab:

mount -a
mount-a

File & directory commands

Command
Description
Is List the contents of a directory
cd Change directory
mkdir Create directory
rmdir Remove directory
cp Copy file
mv Move file
rm Remove file
pwd Print the present working directory
file Print the presumed type of a file
chmod Change the permission attributes of a file

Previous: User management
Next: Networking



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/linux-system-administration/file-system.php