<<

The System

By High School Technology Services myhsts.org Recap From Previous Session

In the previous session we learned about Managing Users and Groups. We covered - ▪ Setting Policies ▪ User File Management ▪ The /etc/passwd file ▪ The /etc/ file ▪ The /etc/group file ▪ The /etc/gshadow file ▪ Adding Users ▪ Modifying User Accounts ▪ Deleting User Accounts ▪ Working with Groups ▪ Setting User Environments Filesystem Types Conventional Structure Mounting a

To attach a certain file system, use the in the following form: mount [option…] device directory The device can be identified by a full to a device (for example, “/dev/sda3”), a universally unique identifier (UUID; for example, “UUID=34795a28-ca6d-4fd8-a347-73671d0c19cb”), or a label (for example, “LABEL=home”). Note that while a file system is mounted, the original content of the directory is not accessible. The /etc/ File

Fstab is your ’s file system table. In the old days, it was the primary way that the system mounted files automatically. Nowadays, you can plug in a USB drive of any kind and it’ll just pop up in Nautilus like it does in Windows and Mac OS, but once upon a , you had to manually mount those disks to a specific folder using the “mount” command. This held true for DVDs, CDs, and even floppies (remember those?). The fstab file is located : /etc/fstab Special Files (Device Files)

A is an interface for a that appears in a file system as if it were an ordinary file. In -like operating systems, these are usually found under the /dev directory and are also called device nodes.

For a definitive, but usually less easy to answer, look in the kernel documentation. First determine whether the device is a block device or a character device, and its major and minor number.

An is a structure on a filesystem on Linux and other Unix-like operating systems that stores all the information about a file except its name and its actual data. A data structure is a way of storing data so that it can be used efficiently. Hard File Links

In Linux when you perform an listing in a directory the listing is actually is a list of references that map to an inode. When you create a hard the is yet another reference to the same inode as the original file. A hard link allows a user to create two exact files without having to duplicate the data on disk. However unlike creating a , if you modify the hard link you are in turn modifying the original file as well as they both reference the same inode.

Hard links have some limitations however, in most (but not all) Unix/Linux distributions hard links cannot be created for directories. Hard links are also not allowed to cross file systems. Inodes are unique to each file system, because a hard link is a second reference to the same inode they cannot be used across multiple file systems. Soft File Links

A is similar to a hard link in that it is used to link to an already existing file, however it is very different in its implementation. A symbolic link is not a reference to an inode but rather an pointer that redirects to another file or directory.

Symlinks do not have the same restrictions as hardlinks, a symlink can be used to reference a file in another file system. Symlinks can also be used to point to a directory. Creating New File Systems with

The mkfs (i.e., filesystem) command is used to create a filesystem (i.e., a system for organizing a hierarchy of directories, subdirectories and files) on a formatted storage device or media, usually a partition on a (HDD). mkfs is actually just a front-end for the various specific filesystem creation programs that are available in Linux, such as mke2fs, mkfs. and mkfs.vfat. The specific program is searched for first in several standard directories such as /sbin, /sbin/fs, /sbin/fs.d and /etc/fs (the precise list is defined when mkfs is compiled) and then in the directories listed in the PATH (which lists the directories that the system searches for an executable program). mkfs's syntax is mkfs [ -V ] [ -t fstype ] [ fs-options ] filesys [ blocks ] The lost+found Directory

The lost+found folder is a part of Linux, macOS, and other UNIX-like operating systems. Each file system—that is, each partition—has its own lost+found directory. You’ll recovered bits of corrupted files here. Repairing File Systems with

On Linux, the fsck command—short for “file system check”—examines your file systems for errors. fsck may find bits of “orphaned” or corrupted files in the file system. If it does, fsck removes those corrupted bits of data from the file system and places them in the lost+found folder.

For example, if you abruptly shut your computer down while it’s running and files are being written to the hard drive, the fsck tool may automatically examine your file system the next time you boot your computer. If it finds any corrupted data, it places it in the file system’s lost+found folder. The Journaling Attribute

A journaling filesystem is a filesystem that maintains a special file called a journal that is used to repair any inconsistencies that occur as the result of an improper shutdown of a computer. Such shutdowns are usually due to an interruption of the power supply or to a software problem that cannot be resolved without a rebooting. Journaling filesystems metadata (i.e., data about files and directories) into the journal that is flushed to the HDD before each command returns. In the event of a system crash, a given set of updates may have either been fully committed to the filesystem (i.e., written to the HDD), in which case there is no problem, or the updates will have been marked as not yet fully committed, in which case the system will read the journal, which can be rolled up to the most recent point of data consistency. Looking Forward

In the next session we’re doing to learn about Linux File Security. We’ll cover - ▪ File Permissions ▪ Directory Permissions ▪ Octal Representation ▪ Changing Permissions ▪ Setting Default Permissions ▪ Access Control Lists (ACLs) ▪ The getfacl and setfacl commands ▪ SUID Bit ▪ SGID Bit ▪ The Thank You

By High School Technology Services myhsts.org