Features of file-system

While reading about the File-system and it’s hierarchy this blog will be about it’s attributes and features. Commands on how to mount a file-system and network shares.

Let me jot down about lsattr and chattr; lsattr allows to list file attributes on a Linux second extended file-system and chattr allows a user to set certain attributes of a file. Flag values are stored in the file inode and can be set by the super user, flags such as (i) immutable, (a) append-only, (d) no-dump, (A) no atime update. Files which are set with (i) attribute cannot be changed, renamed, deleted or modified even by the root user, set with (a) append-only attribute will allow the file to open only int the append mode for writing. A file with the (d) no-dump attribute set is ignored when the dump program is run. This is useful for swap and cache files that you don’t want to waste time backing up.

The format for chattr: $ chattr [+|-|=mode] filename

mkfs utility is used for formatting a file for partition. Even though this is just a front-end for file-system specific programs, each of which has a particular options.

The general format for mkfs: mkfs [-t fstype] [options] [device-file]
where [device-file] is usually a device name like /dev/sda3 or /dev/vg/lvm1

Each file-systems has it’s own particular options when formatting.

Coming down to fsck utility which is designed to check errors. The general format for fsck is

fsck [-t fstype] [options] [device-file]
where [device-file] is usually a device name like /dev/sda3 or /dev/vg/lvm1.

Even if any error found it can be fixed one by one manually with the -r option or automatically with the -a option. In anyways journalling file-systems are much faster to check than older generation file-systems in two reasons:

  • You rarely need to scan the entire partition for errors, as everything but the very last transaction has been logged and confirmed, so it takes almost no time to check.​
  • Even if you do check the whole filesystem, newer filesystems have been designed with fast fsck in mind; older filesystems did not think much about this when they were designed as sizes were much smaller.
The followind command can be used : $ sudo fsck -t ext4 /dev/sda10

fsck is run automatically after a set number of mounts or a set interval since the last time it was run or after an abnormal shutdown. It should only be run on unmounted filesystems. All accessible files in Linux are organized into one large hierarchical tree structure with the head of the tree being the root directory (/).

The mount program allows attaching at any point in the tree structure; unmount allows detaching them. The mount point is the directory where the file is to be attached so it must exist before the mount can use it. As a known fact that mkdir command is used to create an empty directory, if a pre-existing directory is used and it contains files prior to being used as a mount point, they will be hidden after mounting. These files are not deleted and will again be visible when the filesystem is unmounted. By default only super user can mount an d unmount file-systems.

The general format for mount is : $ mount [options] (source) (directory)

Filesystems can be unmounted, as in:

$ umount [device-file | mount-point]

It is common to mount remote file-systems through network shares, so they appear as if they were on the local machine. Probably the most common method used historically has been NFS (Network File System). NFS was originally developed by Sun Micro systems in 1989, and has been continuously updated. Modern systems use NFSv4, which has been continuously updated since 2000. Because a network filesystem may be unavailable at any time, eith​er because it is not present on the network share, or the network is unavailable, systems have to be prepared for this possibility. Linux systems have long had the ability to mount a filesystem only when it is needed. Historically, this was done using autofs.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

Create your website with WordPress.com
Get started
%d bloggers like this: