Note_Tech

All technological notes.


Project maintained by simonangel-fong Hosted on GitHub Pages — Theme by mattgraham

Linux - Storage Fundamental

Back


Storage Fundamental


Storage Management


Master Boot Record (MBR)


GUID Partition Table (GPT)


Display block device

Command Description
lsblk List information about block devices.
lsblk -l Shows a list-style output (each block device on one line).
lsblk -f Displays information about block devices, including filesystem type
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT Customizes output columns (e.g., name, size, type, mountpoint).
lsblk -d Displays information about block devices but excludes their partitions.
lsblk -r Excludes devices that are removable (e.g., USB drives).
lsblk --output NAME,FSTYPE,UUID Displays specified columns (name, filesystem type, and UUID).
sudo blkid Display all block devices attributes.
sudo blkid /dev/nvme0n1p1 Display a specific block device.

lsblk01.png

blkid01.png


Display disk partitions

CMD DESC
smartctl -a /dev/sda1 Display SMART health information for the disk /dev/sda1.
fdisk -l List partition tables of all disks
fdisk device_name Start editing a specific disk

Display Filesystem Disk Usage

Explanation

df

# Filesystem                     1K-blocks    Used Available Use% Mounted on
# devtmpfs                         1830312       0   1830312   0% /dev
# tmpfs                            1860416       0   1860416   0% /dev/shm
# tmpfs                            1860416    9768   1850648   1% /run
# tmpfs                            1860416       0   1860416   0% /sys/fs/cgroup
# /dev/mapper/rhel_rhelhost-root  27245572 7114196  20131376  27% /
# /dev/nvme0n1p1                   1038336  278688    759648  27% /boot
# tmpfs                             372080      12    372068   1% /run/user/42
# tmpfs                             372080       4    372076   1% /run/user/1000
Col Desc
Filesystem The file system or disk partition in use.
1K-blocks Total space in 1K blocks for the file system.
Used The space currently used (in 1K blocks).
Available The space available for use (in 1K blocks).
Use% The percentage of space used.
Mounted on The mount point where the file system is attached in the directory tree.

Filesystem Name Type Purpose Mounted on
/dev/mapper/rhel_rhelhost-root ext4 (or LVM) The root file system where the operating system and user files reside. /
/dev/nvme0n1p1 ext4 To store boot files like the kernel and initramfs. /boot
devtmpfs devtmpfs for device files created by the kernel. /dev
tmpfs tmpfs shared memory (RAM-based). /dev/shm
tmpfs tmpfs for runtime data like logs and PID files. /run
tmpfs tmpfs for managing control groups (cgroups). /sys/fs/cgroup
tmpfs tmpfs for user-specific runtime data (for user ID 42). /run/user/42
tmpfs tmpfs for user-specific runtime data (for user ID 1000). /run/user/1000





Commands

Command Description
df Report file system disk usage.
df -a show all disk space usage
df -h Display disk usage in human-readable format.
df -BM Display disk usage in MB size
df -T Include file system type in the output.
df -h \| sort -k5 -r sort disk usage by use%

Display File Usage

Command Description
du Display space usage of the current directory.
du --max-depth=num Display space usage only for num depth
du target_dir Display space usage of the target directory.
du -sh target_dir Summarize size of target directory in human-readable format.
du target_file Display space usage of the target file.
du -h target_file Display space usage of the target file in human-readable format

TOP