Managing Storage Flashcards
Pseudo (Virtual) Filesystems
Main locations of pseudo FS
Only exists in RAM
Two primary locations: /proc, /sys
What /proc and /sys dirs contain
- /proc contains info about processes running on the system.
- /sys contains info about system’s hardware and kernel modules
Main Filesystem locations
/ -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
Swap space types
- swap partition - separate partition
2. swap file- similar to page file, and much slower than dedicated partiton
Recommended sizing of swap
- Older rules: 1.5-2 times of RAM
2. Not less than 50% of RAM
Mount point
Taking a partition and mounting it to a dir
List all partitions and mount points that are in use on the system
mount Disk labeling: xvda- virtual disk on zen hyperviser sda- sata or scsi nvm- ssd
List block devices
The same and show FS type for partititons
lsblk
lsblk -f
List information about partitions including type, size etc
fdisk -l /dev/sda or fdisk -l /dev/xvda
Show summary of devices and their partitions
partprobe -s
Show summary of swap usage, its size, type(partition or file)
swapon –summary
Legacy MBR partitions.
Utility to create partitions and its usage
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
Partition ID-s
83- standard Linux FS
82- Standard swap
8e- Linux LVM volumes
GPT partitions
gdisk /dev/sdb
parted (here for mklabel instead of msdos use gpt)
Create swap partition
gdisk /dev/sda
here use Hex code=8200 (swap)
instead of default 8300
Format a partition to be used as swap space
mkswap -L SWAP /dev/sda2
Enable swap partition
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
Make swap permanent
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]
Disable swap
swapoff -L SWAP
Types of Linux FS
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)