ch5.2 Storage - Management, Directory Structure Flashcards
/etc/mtab file
reports the status of currently mounted file systems but /proc/mounts is similar but usually more accurate and more up-to-date
/proc/partitions file
part of the virtual file system and contains info on each partition attached to the system
format of /proc/partitions file
columns named major, minor, #blocks, and name
lsblk
Bash command that displays info about block storage devices currently available on the system
lsblk syntax and options
-a
-r
-f
-l
-m
lsblk [options] [device name]
-a list empty devices
-r list devices excluding provided ouput devices
-f display additional information
-l display results in list format
-m display device permission information
blkid
prints each block device in a flat format and includes some additional information
probably not as useful as lsblk -f
blkid syntax
blkid [options] [device name]
most useful tools to manage an ext style file system
e2fsck
resize2fs
tune2fs
dumpe2fs
fsck
Bash command to check the correctness and validity of a file system
Most systems run this command at boot so that any errors can be detected and corrected before the system can be used
A file system must be unmounted before it can be scanned by this command
fsck syntax and options
-r
fsck [options] [device/file system name]
-r repair file system
resize2fs description
Bash command to resize ext2, ext3, or ext4 file systems
resize2fs syntax
resize2fs [options] [device/file system name] [desired size]
tune2fs
Bash command to confirm and adjust various tunable parameters of the ext2/ext3 file systems
can also add a journal to an existing ext2 or ext3 file system
tune2fs syntax and options
-j
-i
-c
-C
-r
-e
-l
-U
tune2fs [options] [device/file system name]
-j used as an ext3 journal to the existing file
-i [d|m|w] specify the maximum time interval
-c specify the maximum number of mounts
-C specify the number of possible mounts
-r specify the number of reserved file system blocks
-e specify the behavior of the kernel code
-l list the contents within the superblock
-U set the specified UUID
Superblock
a record of the characteristics of a filesystem including it’s size, type, and status
dumpe2fs
Bash command that prints the superblock and block group information for the selected device using an ext2, ext3, or ext4 file system
dumpe2fs syntax and options
-x
-b
-f
-i
dumpe2fs [options] [device/file system name]
-x Print a detailed report about block numbers
-b Print the bad blocks
-f Force print the file system status regardless of file system flags
-i Print file system data from an image file created using e2image command
lsscsi
Bash command used to list information about SCSI devices connected to a Linux system
xfs_info
Bash command to print details about the xfs file system
xfs_admin
Bash Command to change the parameters of an xfs file system
xfs_metadump
Bash command to copy the superblock metadata of the xfs file system to a file
xfs_growfs
Bash command to expand the xfs file system to fill the drive size
xfs_copy
Bash command to copy the contents of the xgs file system to another location
xfs_repair
Bash command to repair and recover a corrupt xfs file system
xfs_db
Bash command to debug an xfs file system
fcstat
Bash command to interact with and display statistics of Fibre Channel connected devices
-e for all statistics
What is a Directory?
A container for other files
What are Special Files?
System files stored in the /dev directory
What is a Link file?
A file that make a file accessible in multiple parts of the system’s file tree similar to a windows shortcut
What are Domain Sockets?
Files that provide inter-process networking that is protected by the file system’s access control
What are Named Pipes?
Files that enable processes to communicate with each other without using network sockets
Filesystem Hierarchy Standard (FHS)
A set of guidelines for the names of files and directories and their locations on Linux systems
/bin
Stores essential command-line utilities and binaries
/boot
Stores the files necessary to boot the Linux operating system
/dev
Stores hardware and software device drivers
/etc
Stores basic configuration files
/home
Stores users’ home directories, including personal files
/lib
Stores shared program libraries required by the kernel, command-line utilities, and binaries
/media
Stores mount points for removable media such as CD-ROMs and floppy disks
/mnt
Refers to the mount point for temporary mounting file systems
/opt
Stores optional files for large software packages
/proc
Represents continually updated kernel information to the user in a typical file format
/root
Refers to the home directory of the root user
/sbin
Stores binaries used for completing the booting process which are also used by the root user
/sys
Stores information about devices
/tmp
Stores temporary files that may be lost on system shutdown
/usr
A read-only directory that stores small programs and files accessible to all users
/var
Stores variable files, or files that are expected to constantly change while the system is running
important /usr subdirectories
/usr/bin
/usr/local
/usr/lib
/usr/lib64
/usr/share
/usr/bin
executable programs common to all users
/usr/local
custom built applications stored here by default
/usr/lib
object libraries and internal binaries needed by executable programs
/usr/lib64
object libraries and internal binaries needed by executable programs but meant for 64 bit systems
/usr/share
read-only architecture independent files that can be shared among different architectures of an operating system
Current Working Directory (CWD)
Location of current user access
Can be accessed using the “.” shorthand
Parent Directory
Directory above the CWD
Can be accessed using the “..” shorthand
What type of slash do Linux and Windows use in their file system?
Linux uses forward slashes
Windows uses back slash
Relative Path
A file path that starts at the Current Working Directory
pwd
Bash command that prints the Current Working Directory