104 Devices, Linux Filesystems, Filesystem Hierarchy Standard KT Flashcards
(39 cards)
104.1 Create partitions and filesystems
The following is a partial list of the used files, terms and utilities:
fdisk gdisk parted mkfs mkswap
fdisk
Command: fdisk is a dialog-driven program for creation and manipulation of partition tables. It understands GPT, MBR, Sun, SGI and BSD partition tables.
fdisk [options] device
gdisk
Command: GPT fdisk (aka gdisk) is a text-mode menu-driven program for creation and manipulation of partition tables. It automatically converts a MBR partition table or BSD disklabel stored without a MBR carrier partition to the GPT format.
gdisk [ -l ] device
parted
Command: parted is a program to manipulate disk partitions. It supports multiple partition table formats, including MS-DOS and GPT. It is useful for creating space for new operating systems, reorganising disk usage, and copying data to new hard disks.
parted [options] [device [command [options…]…]]
mkfs
Command: mkfs is used to build a Linux filesystem on a device, usually a hard disk partition. This mkfs frontend is deprecated in favour of filesystem specific mkfs. utils.
mkfs [options] [-t type] [fs-options] device [size]
mkswap
Command: mkswap sets up a Linux swap area on a device or in a file.
mkswap [options] device [size]
104.2 Maintain the integrity of filesystems
The following is a partial list of the used files, terms and utilities:
du df fsck e2fsck mke2fs tune2fs xfs_repair xfs_fsr xfs_db
du
Command: Summarize disk usage of the set of FILEs, recursively for directories.
du [OPTION]… [FILE]…
du [OPTION]… –files0-from=F
df
Command: df displays the amount of disk space available on the file system containing each file name argument. If no file name is given, the space available on all currently mounted file systems is shown.
df [OPTION]… [FILE]…
fsck
Command: fsck is used to check and optionally repair one or more Linux filesystems.
fsck [options] – [fs-options] [ …]
e2fsck
Command: e2fsck is used to check the ext2/ext3/ext4 family of file systems.
e2fsck [ -pacnyrdfkvtDFV ] [ -b superblock ] [ -B blocksize ] [ -l|-L bad_blocks_file ] [ -C fd ] [ -j external-journal ] [ -E extended_options ] [ -z undo_file ] device
mke2fs
Command: mke2fs is used to create an ext2, ext3, or ext4 filesystem, usually in a disk partition (or file) named by device.
mke2fs [-c|-l filename] [-b block-size] [-C cluster-size]
[-i bytes-per-inode] [-I inode-size] [-J journal-options]
[-G flex-group-size] [-N number-of-inodes]
[-d root-directory]
[-m reserved-blocks-percentage] [-o creator-os]
[-g blocks-per-group] [-L volume-label]
[-M last-mounted-directory] [-O feature[,…]] [-r fs-revision] [-E extended-option[,…]] [-t fs-type] [-T usage-type ]
[-U UUID] [-e errors_behavior][-z undo_file]
[-jnqvDFSV] device [blocks-count]
tune2fs
Command: tune2fs allows the system administrator to adjust various tunable filesystem parameters on
Linux ext2, ext3, or ext4 filesystems.
tune2fs [ -l ] [ -c max-mount-counts ]
[ -e errors-behavior ] [ -f ] [ -i interval-between-checks ]
[ -I new_inode_size ] [ -j ] [ -J journal-options ]
[ -m reserved-blocks-percentage ]
[ -o [^]mount-options[,…] ] [ -r reserved-blocks-count ] [ -u user ] [ -g group ] [ -C mount-count ]
[ -E extended-options ] [ -L volume-label ]
[ -M last-mounted-directory ] [ -O [^]feature[,…] ]
[ -Q quota-options ] [ -T time-last-checked ] [ -U UUID ]
[ -z undo_file ] device
xfs_repair
Command: xfs_repair repairs corrupt or damaged XFS filesystems.
xfs_repair [ -dfLnPv ] [ -m maxmem ] [ -c subopt=value ]
[ -o subopt[=value] ] [ -t interval ] [ -l logdev ] [ -r rtdev ] device
xfs_fsr
Command: xfs_fsr improves the organization of mounted filesystems. The reorganization algorithm operates on one file at a time, compacting or otherwise improving the layout of the file extents (contiguous blocks of file data).
xfs_fsr [-v] [xfsdev | file] …
xfs_db
Command: xfs_db is used to examine an XFS filesystem.
xfs_db [ -c cmd ] … [ -i|r|x|F ] [ -f ] [ -l logdev ] [ -p progname ] device
104.3 Control mounting and unmounting of filesystems
The following is a partial list of the used files, terms and utilities:
/etc/fstab /media/ mount umount blkid lsblk
/etc/fstab
/etc/fstab file is a system configuration file that contains all available disks, disk partitions and their options.
/media/
/media/ directory contains subdirectories which are used as mount points for removeable media such as floppy disks, cdroms and zip disks.
mount
Command: The mount command serves to attach the filesystem found on some device to the big file tree.
mount [-fnrsvw] [-t fstype] [-o options] device dir
umount
Command: The umount command detaches the mentioned file system(s) from the file hierarchy.
umount [-dflnrv] {directory|device}…
blkid
Command: The blkid program is the command-line interface to working with the libblkid(3) library. It can determine the type of content (e.g. filesystem or swap) that a block device holds, and also the attributes (tokens, NAME=value pairs) from the content metadata (e.g. LABEL or UUID fields).
blkid –label label | –uuid uuid
lsblk
Command: lsblk lists information about all available or the specified block devices. The lsblk command reads the sysfs filesystem and udev db to gather information.
lsblk [options] [device…]
104.5 Manage file permissions and ownership
The following is a partial list of the used files, terms and utilities:
chmod
umask
chown
chgrp