Managing Storage Flashcards

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

A

blkid

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
Q

Source file for mount command

A

/etc/mtab

26
Q

Scan /etc/fstab to mount new fs listed in the file

A

mount -a

27
Q

Meaning of defaults option in /etc/fstab

A

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
Q

Unmount fs

A

umount /dev/sda1 or umount -L SRV (to do fsck further on)

umount /dir

29
Q

Mount fs having a label

A

mkfs.xfs -L OPTIONAL /dev/sdb2
mount -L OPTIONAL -t xfs -o ro, nouser,noexec /opt
ls /opt

30
Q

Mount cdrom to media dir

Mount iso file to media dir

A

mount /dev/sr0 /media
mount /root/install.iso -o ro,loop /media
after that umount /media

31
Q

Multipath storage

A

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
Q

Common utility to check FS

Get only report

A

fsck /dev/sda1

fsck -r LABEL=SRV (unmount fs first)

33
Q

Other utilities to check FS

  1. ext2-4
  2. xfs
A

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
Q

Adjust FS parameters for ext2-4 FS types

A

tune2fs -l /dev/sdb1 (list parameters applied)

tune2fs -i 3w /dev/sdb1 (perform next check after 3 weeks)

35
Q

File space usage

A
du -h
du -h /home/user/ --max-depth=2
du --inodes /etc
du -sh- get only summary
du -sh /home
36
Q

Show available disk space on FS

A

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
Q

Show RAM+swap

A

free -m

38
Q

List all physical volumes

A

pvscan

39
Q

Initialize PV for use by LVM

A

pvcreate /dev/sdb /dev/sdc

40
Q

Create a new volume group on block devices

A

vgcreate my_vg /dev/sdb /dev/sdc

41
Q

Scan for volume groups

A

vgscan

42
Q

Create a logical volume

A

lvcreate -n(name) my_lv -L (size) 10G my_vg

43
Q

Display information about logical volumes

A

lvdisplay my_vg/my_lv

44
Q

Create file system on VG and logical volumes

A

mkfs.ext4 /dev/my_vg/my_lv

45
Q

Create dir and mount to LVM

A

mk dir /mnt/volume

mount /dev/my_vg/my_lv /mnt/volume

46
Q

Report CPU and i/o stat for devices and partitions

A

iostat

47
Q

Test disk latency on a system

A

ioping -c 12 (count) . (this current drive)

48
Q

List all limits on the system

A

ulimit -a

49
Q

Soft and hard limits

A

Soft-limit that user or process can change without su privileges. Hard- up to which it can be changed without invoking su privileges.

50
Q

I/O schedulers

A

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
Q

Display disk limits (quotas)

A

quota -u [user] user
display quota on local fs only(no NFS): quota -l
display quota on all NFS FS: quota -A