1-Filesystem and Device Files Flashcards
pseudo file system
A pseudo file system is something that looks like system devices but is not associated to real hardware and just exposes kernel information in human readable format.
proc, sysfs, ioports are examples of pseudofilesystems
/etc/fstab
A file that tells the system what storage devices to automatically mount at boot. A user can either display device names here or use the devices UUID number in case devices are frequently swaped.
Get the UUID with the command blkid.
Information the file needs:
Device Name: Name of the device.
System Mount: Where the device will mount on a user’s system
File System Type: If this is unknown, auto will detect it.
Options: defaults is the most common man fstab gives more options.
Partition Back up: 0=no 1=yes
Check Disk: Check for file system errors 0=no 1=yes
/proc
A directory that is classified as a pseudo file system. The /proc directory contains files with information about local devices and running processes. Process files are given it’s own directory named after it’s PID (Process Identification Number).
/proc/interrupts
it shows info about how are the hardware is communicating with CPU and interrupt is a number associated with a process that is a driver or kernel module that uses these numbers to interrupt the CPU to communicate with it (ex. eth0 is interrupt)
/proc/ioports
Addresses that identify a device.
The CPU uses IO ports to communicate with devices and check the status of a device.
/proc/dma
it is address that a device can used to access system memory directly (without going through CPU) Example usb (cat usb)
/sys
A pseudo file system created to address problems with the unstructured /proc directory. /sys stores a list of hardware and kernal modulars on a system and does not store running processes like the /proc directory. (it list general info about hardware and kernel modular)
/dev
it is not a separate file system, but it is a method of listing hardware within a directory (disk, floppy, tty, loopback, ram, standard input and standard output, ..etc).
udev
is a device manager and associated with /dev which contain devices date. udevice is detect the device when we add or remove devices (hot plugging and hot swapping)
dbus
it relating to /dev and it allows desktop app to send messages to devices
udev can send messages using dbus to desktop app to pop a message (example when we insert CD-ROM)
What does lsmod command do? what directory is it linked to?
Lists the kernel modules loaded into memory and any dependencies. Linked to /proc/modules. lsmod is just nicely format the content of /proc/module
command to display CPU information
lscpu
lscpu -ae
Shows all active CPU information and offline CPU’s as well
lsblk
List the block devices or storage devices and partitions of storage devices mounted on the system.
- f flag will include the file system type.
- t will display the output in a tree format.
lspci
display pci info (slot and port) of pci devices (ex. audio device, usb,..etc)
lspci -vmm display more organized info in separate sections