Unix / Linux - File System Basics | file system | Introduction To the File System

File Systme


A file system is a logical collection of files on a partition or disk. A partition is a container for information and can span an entire hard drive if desired.

Your hard drive can have various partitions which usually contain only one file system, such as one file system housing the /file system or another containing the /home file system.

One file system per partition allows for the logical maintenance and management of differing file systems.


About Unix Filesystems: Moments from History


In the beginning was the System V filesystem. Well, not really, but that’s where we’ll
start. This filesystem type once dominated System V–based operating systems.*
The superblock of standard System V filesystems contained information about cur-
rently available free space in the filesystem in addition to information about how the
space in the filesystem is allocated. It held the number of free inodes and data blocks,
the first 50 free inode numbers, and the addresses of the first 100 free disk blocks.
After the superblock came the inodes, followed by the data blocks.




Administering a filesystem

includes tasks such as:
• Making local and remote files available to users
• Monitoring and managing the system’s disk resources
• Protecting against file corruption, hardware failures, and user errors via a well-
planned backup schedule
• Ensuring data confidentiality by limiting file and system access
• Checking for and correcting filesystem corruption
• Connecting and configuring new storage devices when needed


Filesystem Types





Default Local Filesystems


characteristics of the default local filesystem types for the various
Unix versions.



Managing Filesystems


Mounting and Dismounting Filesystems
Disk Special File Naming Conventions
filesystem configuration file
checking local filesystem integrity with the fsck utility


Directory Structure


Unix uses a hierarchical file system structure, much like an upside-down tree, with root (/) at the base of the file system

A Unix filesystem is a collection of files and directories that has the following properties −

  • It has a root directory (/) that contains other files and directories.

  • Each file or directory is uniquely identified by its name, the directory in which it resides, and a unique identifier, typically called an inode.

  • By convention, the root directory has an inode number of 2 and the lost+found directory has an inode number of 3. Inode numbers 0 and 1 are not used. File inode numbers can be seen by specifying the -i option to ls command.

  • It is self-contained. There are no dependencies between one filesystem and another.

  • The directories have specific purposes and generally hold the same types of information for easily locating files. Following are the directories that exist on the major versions of Unix −

Sr.No.Directory & Description
1

/

This is the root directory which should contain only the directories needed at the top level of the file structure

2

/bin

This is where the executable files are located. These files are available to all users

3

/dev

These are device drivers

4

/etc

Supervisor directory commands, configuration files, disk configuration files, valid user lists, groups, ethernet, hosts, where to send critical messages

5

/lib

Contains shared library files and sometimes other kernel-related files

6

/boot

Contains files for booting the system

7

/home

Contains the home directory for users and other accounts

8

/mnt

Used to mount other temporary file systems, such as cdrom and floppy for the CD-ROM drive and floppy diskette drive, respectively

9

/proc

Contains all processes marked as a file by process number or other information that is dynamic to the system

10

/tmp

Holds temporary files used between system boots

11

/usr

Used for miscellaneous purposes, and can be used by many users. Includes administrative commands, shared files, library files, and others

12

/var

Typically contains variable-length files such as log and print files and any other type of file that may contain a variable amount of data

13

/sbin

Contains binary (executable) files, usually for system administration. For example, fdisk and ifconfig utlities

14

/kernel

Contains kernel files




Navigating the File System


Now that you understand the basics of the file system, you can begin navigating to the files you need. The following commands are used to navigate the system 


Sr.No.Command & Description
1

cat filename

Displays a filename

2

cd dirname

Moves you to the identified directory

3

cp file1 file2

Copies one file/directory to the specified location

4

file filename

Identifies the file type (binary, text, etc)

5

find filename dir

Finds a file/directory

6

head filename

Shows the beginning of a file

7

less filename

Browses through a file from the end or the beginning

8

ls dirname

Shows the contents of the directory specified

9

mkdir dirname

Creates the specified directory

10

more filename

Browses through a file from the beginning to the end

11

mv file1 file2

Moves the location of, or renames a file/directory

12

pwd

Shows the current directory the user is in

13

rm filename

Removes a file

14

rmdir dirname

Removes a directory

15

tail filename

Shows the end of a file

16

touch filename

Creates a blank file or modifies an existing file or its attributes

17

whereis filename

Shows the location of a file

18

which filename

Shows the location of a file if it is in your PATH




Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Ok, Go it!