Disk and File System Management Flashcards
lsblk
A tool to list block devices.
-f: filesystem info included, UUID.
fdisk
An MBR command to create MBR partitions. p: partition in table m: help n: new partition (enter to accept defaults) p: primary e: extended Add partition # sector location or size of partition w: write file system table to disk
parted
An more MBR and GPT app to list partitions help: lists all commands p: print partition info mklabel : adds label for type mkpart: needs ,
gdisk
fdisk-styled for GPT.
?: For help.
mkswap
NEEDS AN EXISTING SWAP ID PARTITION TO USE
Formats partition for use as swap space
-L: label add
swapon
Enables swap spaces Swapoff disables /etc/fstab example LABEL=SWAP swap swap defaults 0 0 -a: all in /etc/fstab -U: by UUID -L: by label
mkfs
Adds file system to specified partition
-t or .
-L
Note: can get UUID via blkid
df
Shows available disk space on file system. (disk free) lkblock, used, available, %, mounted on. -i: shows inode info per directory -h: human —total: shows total for all file sys.
du
Shows used space (disk used)
—inodes: shows inode info for each directory and sub directory
-h: human
—max-depth=: shows down to directories in.
-s: summary of spaces used in directory.
fsck
File system check utility to run on unmounted devices. Configured in /etc/fstab. Specify device like in fstab.
-r: report
e2fsck
ext2,3,4 specific utility. Can also display file system journal
- f: force to rerun
- p: repair file system
mke2fs
Creates new ext2,3,4 file system.
mke2fs.conf
Lists defaults for file systems
- t: type
- L: label
tune2fs
Adjusts parameters, lost&found for recovery
- l: lists parameters
- i: interval for times checked
Various xfs tools
xfs_repair: similar to e2fsck xfs_sfr: recognizes data stored in blocks. Similar to defrag xfs_db: debugging tool Frag = fragmentation Freesp = free space on device