Managing Storage Flashcards

(51 cards)

1
Q

Pseudo (Virtual) Filesystems

Main locations of pseudo FS

A

Only exists in RAM

Two primary locations: /proc, /sys

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What /proc and /sys dirs contain

A
  1. /proc contains info about processes running on the system.
  2. /sys contains info about system’s hardware and kernel modules
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Main Filesystem locations

A

/ -root dir
/var -log files and dynamic content such as web sites, email files
/home -user’s home dir
/boot -often on a separate partition, and where Linux kernel and supporting files are stored, which help a system to boot up
/opt - optional software, used by third-party vendors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Swap space types

A
  1. swap partition - separate partition

2. swap file- similar to page file, and much slower than dedicated partiton

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Recommended sizing of swap

A
  1. Older rules: 1.5-2 times of RAM

2. Not less than 50% of RAM

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Mount point

A

Taking a partition and mounting it to a dir

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

List all partitions and mount points that are in use on the system

A
mount
Disk labeling: 
xvda- virtual disk on zen hyperviser
sda- sata or scsi
nvm- ssd
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

List block devices

The same and show FS type for partititons

A

lsblk

lsblk -f

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

List information about partitions including type, size etc

A

fdisk -l /dev/sda or fdisk -l /dev/xvda

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Show summary of devices and their partitions

A

partprobe -s

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Show summary of swap usage, its size, type(partition or file)

A

swapon –summary

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Legacy MBR partitions.

Utility to create partitions and its usage

A
1. fdisk /dev/sda
m- help
n -new
p- partition table
type: primary or secondary
partition number: 1
w -write
2. parted
help
mklabel msdos
mkpart:
choose primary partition
File system type: ext2 or ext3
Start: 1
End: 900
and enter quit
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Partition ID-s

A

83- standard Linux FS
82- Standard swap
8e- Linux LVM volumes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

GPT partitions

A

gdisk /dev/sdb

parted (here for mklabel instead of msdos use gpt)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Create swap partition

A

gdisk /dev/sda
here use Hex code=8200 (swap)
instead of default 8300

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Format a partition to be used as swap space

A

mkswap -L SWAP /dev/sda2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Enable swap partition

A

swapon -a (reread /etc/fstab, old entries will be skipped)
specified:
swapon -U (UUID)
swapon -L SWAP
free -m to check if available free space is increased

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Make swap permanent

A

vim /etc/fstab
add entry:
LABEL=SWAP [or /dev/sda2 or UUID=…] swap [mount point] swap [type] defaults 0 [dumping or backup] 0 [fs checking]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Disable swap

A

swapoff -L SWAP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Types of Linux FS

A
Non-journaling:
ext2-legacy, released in 1993
Journaling:
ext3-released in 2001
ext4-released in 2006
xfs (very fast and works great with small files) -released in 1991, ported in Linux in 2001. Default in RHEL, Centos7
\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Btrfs uses Copy on write COW, uses subvolumes similar to partitions, and can be accessed like a dir
Uses snapshots
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
FAT (Linux uses VFAT)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Display FS’s UUID

22
Q

Create a file system on a new partition

A

mkfs -t ext4 -L SERV /dev/sdb1
mkfs.xfs -L OPTIONAL /dev/sdb2
under the hood mkfs runs mke2fs for ext2-3 FS types
/etc/mke2fs.conf contains deafult settings of blocksize,inode-size etc to apply when creating new fs for a partition

23
Q

Mount/unmount dir

A

mount /dev/sda1 /opt

umount /opt

24
Q

Show mounting points of specified types

A

mount -t ext4

25
Source file for mount command
/etc/mtab
26
Scan /etc/fstab to mount new fs listed in the file
mount -a
27
Meaning of _defaults_ option in /etc/fstab
rw - read/write suid- set user id bits to take effect dev- treat that particular filesystem as a device that can be used to write data to exec- permit execution of binary auto- can be mounted with -a option nouser -only root or sudo users can mount async- all io should be done asynchronously ____________ other no default options: user -allow user to mount fs ro- mount fs read-only remount- try to remount fs which was already been mounted noexec-no binaries will be run from that fs
28
Unmount fs
umount /dev/sda1 or umount -L SRV (to do fsck further on) umount /dir
29
Mount fs having a label
mkfs.xfs -L OPTIONAL /dev/sdb2 mount -L OPTIONAL -t xfs -o ro, nouser,noexec /opt ls /opt
30
Mount cdrom to media dir | Mount iso file to media dir
mount /dev/sr0 /media mount /root/install.iso -o ro,loop /media after that umount /media
31
Multipath storage
DM-Multipath -kernel module that makes routing decisions multipath- command responsible for listing devices Multipathd- daemon that monitors paths, reactivates them kpartx- command to create mapper entries HBA -host bus adaptor (to connect a server to the storage)
32
Common utility to check FS | Get only report
fsck /dev/sda1 | fsck -r LABEL=SRV (unmount fs first)
33
Other utilities to check FS 1. ext2-4 2. xfs
1. 1.1 e2fsck (for ext2-4 fs types) checks and repairs e2fsck -f /dev/sda1 (show steps of checking) e2fsck -p /dev/sda1- repair 2. 2.1. xfs_repair 2.2. xfs_fsr- similar to defrag on windows 2.3 xfs_db- debug xfs FS unmount /opt xfs_db /dev/vdb1 (run freesp to show free space, run frag to show frragmentation)
34
Adjust FS parameters for ext2-4 FS types
tune2fs -l /dev/sdb1 (list parameters applied) | tune2fs -i 3w /dev/sdb1 (perform next check after 3 weeks)
35
File space usage
``` du -h du -h /home/user/ --max-depth=2 du --inodes /etc du -sh- get only summary du -sh /home ```
36
Show available disk space on FS
free space of inodes: df -i free space in HR format: df -h df -h /dev/sda1 df --total -h (including pseudo fs, total will include swap and RAM)
37
Show RAM+swap
free -m
38
List all physical volumes
pvscan
39
Initialize PV for use by LVM
pvcreate /dev/sdb /dev/sdc
40
Create a new volume group on block devices
vgcreate my_vg /dev/sdb /dev/sdc
41
Scan for volume groups
vgscan
42
Create a logical volume
lvcreate -n(name) my_lv -L (size) 10G my_vg
43
Display information about logical volumes
lvdisplay my_vg/my_lv
44
Create file system on VG and logical volumes
mkfs.ext4 /dev/my_vg/my_lv
45
Create dir and mount to LVM
mk dir /mnt/volume | mount /dev/my_vg/my_lv /mnt/volume
46
Report CPU and i/o stat for devices and partitions
iostat
47
Test disk latency on a system
ioping -c 12 (count) . (this current drive)
48
List all limits on the system
ulimit -a
49
Soft and hard limits
Soft-limit that user or process can change without su privileges. Hard- up to which it can be changed without invoking su privileges.
50
I/O schedulers
I/O schedulers attempt to improve throughput, but it may lead to some I/O requests waiting for too long, causing latency issues. I/O schedulers attempt to balance the need for high throughput while trying to fairly share I/O requests amongst processes. ____________ cat /sys/block/sda/queue/sheduler bfq (Budget Fair Queuing) Multiqueue -for slower I/O devices. kyber (Multiqueue)- Designed for fast multi-queue devices and is relatively simple (sync and async) none (Multiqueue) The multi-queue no-op I/O scheduler. Does no reordering of requests, minimal overhead. Ideal for fast random I/O devices such as NVME. Not multiqueue: deadline -FIFO (read queue and write queue) cfq (Completely Fair Queueing)-roundrobin, each process gets a clice of time noop (No-operation) Performs merging of I/O requests but no sorting. Good for random access devices (flash, ramdisk, etc) and for devices that sort I/O requests such as advanced storage controllers.
51
Display disk limits (quotas)
quota -u [user] user display quota on local fs only(no NFS): quota -l display quota on all NFS FS: quota -A