Disks admin commands Cheatsheet
fstab - mounted drives on startup
#see the file
cat /etc/fstab
# edit the file (better using ansible instead)
sudo -e /etc/fstab
See fstab doc for more info: https://wiki.debian.org/fr/fstab Ansible doc for mounting volumes: here
Get disks and partions info
df: Space available on disks
#see all
# -h option for human readable Size info in Go,To,etc
df -h
#You can also specify a file
df -h /mnt/ssd2
df -h /dev/sdc1
# see only usage of partition mounted on /mnt
# i use a "ddf" alias for this
df -h | head -n 1 && df -h | grep /mnt
Tree view of disks and mounted partition
sudo lsblk
Get mounted partitions info (UUID, LABEL, etc)
sudo blkid
Format a disk to ext4
sudo mkfs -t ext4 /dev/sdb1
Rename a partition
Make sure you have the e2fsprogs tool installed
sudo apt update && sudo apt install e2fsprogs
ext4 (works w/o umount):
sudo e2label /dev/sdb1 SSD2
ntfs (umount the partition first):
sudo ntfslabel /dev/sdb1 SSD2