EXT4

mkfs.ext4 [-L LABEL -U UUID] /dev/XXX # format partition with ext4
tune2fs -l /dev/XXX # get information about partition

e2fsck /dev/XXX # check fs and repair it

resize2fs /dev/XXX [size] # grow ext4 fs

# shrink ext fs (should be unmounted)
e2fsck -f /dev/XXX
resize2fs /dev/XXX size
# shrink to minimum size
e2fsck -f /dev/XXX
resize2fs -M /dev/XXX size

e4defrag -v /dev/XXX # Defragment

tune2fs -L NEWLABEL /dev/XXX # Change ext4 label
tune2fs -U UUID /dev/XXX # Change UUID (should be unmounted)

tune2fs -m PERCENTAGE /dev/XXX # Resize reserved area

BTRFS

mkfs.btrfs /dev/XXX # Format partition
btrfs filesystem show /dev/XXX # show information about volumes
btrfs filesystem df /point/de/montage # show disk usage info
btrfs filesystem usage /point/de/montage # detailed disk usage info

btrfs check --repair /dev/XXX # Check and repair (should be unmounted)
btrfs scrub start /dev/XXX # Start a scrub (mounted)
btrfs scrub status /dev/XXX # Check scrub status

# Rezise btrfs volume (+- to increase/decrease)
btrfs filesystem resize [+-]TAILLE /point/de/montage
btrfs filesystem resize max /point/de/montage

# Defragment partition (with compression)
btrfs filesystem defragment -rv MOUNTPOINT
btrfs filesystem defragment -rv -clzo MOUNTPOINT

# Change label
btrfs filesystem label MOUNTPOINT LABEL
btrfs filesystem label /dev/XXX LABEL

# Change UUID
btrfstune -U UUU-UUUU-UUUU.... /dev/XXX

XFS

mkfs.xfs /dev/XXX # Format partition
xfs_info /dev/XXX # Information about partition

xfs_repair /dev/XXX # Repair partition (unmounted)

xfs_growfs -D TAILLE /dev/XXX # Grow fs (unmounted)

xfs_fsr -v /dev/XXX # Defragment fs

xfs_admin -L NEWLABEL /dev/XXX # Change Label
xfs_admin -U UUU-UUUU-UUUU.... /dev/XXX # Change UUID (unmounted)

LVM

# Physical Volumes
## Display information
pvdisplay -v
pvs -v
pvs -a
## Operations
pvcreate /dev/sdb1 # Create PV
pvremove /dev/sdb1 # Remove PV
pvmove -v /dev/sdb2 /dev/sdb3 # Move PV

# Volume Groups
## Display information
vgdisplay -v
vgs -v
vgs -a -o +devices
## Operations
vgcreate VolData00 /dev/sdb1 /dev/sdb2 /dev/sdb3 ## Create VG
vgcreate VolData00 /dev/sdb[123] ## Create VG shorthand
vgextend VolData00 /dev/sdb3 # Extend
vgreduce VolData00 /dev/sdb3 # Reduce
vgremove VolData00 # Remove
vgrename VolData00 Data_Vol_01 # Rename


# Logical Volumes
## Display information
lvdisplay -v
lvs -v
lvs -a -o +devices
## Operations
lvcreate -L ${SIZE_IN_GC}G $VG_NAME # Create LV
lvcreate -l 100%FREE $VG_NAME # Create LV from remaining free
sudo lvextend -L +${GB_TO_ADD}G -n /dev/$VG_NAME/$LV_NAME # Extend in GB
sudo lvextend -l 100%FREE /dev/$VG_NAME/$LV_NAME # Extend by percentage of free
sudo lvextend -L ${SIZE}G -n /dev/$VG_NAME/$LV_NAME # Resize to exact size

Other Disk and FS Operations

lsblk -O # List disks and partitions
blkid # Information about a disk or partition

file -s /dev/XXX # Info about files

# Bad blocks detection and repair
badblocks
ddrescue