Learn Linux Disk Partitioning and Mounting in 5 Minutes

Linux disk partitioning and mounting are fundamental operations for managing storage, comparable to partitioning a wardrobe and its entrances. Steps: 1. View disks: use lsblk or sudo fdisk -l to confirm disks/partitions, and df -h to view mounted partitions. 2. Create a partition: enter sudo fdisk /dev/sdb, type n to create a new primary partition, set the size (e.g. +20G), and press w to save. 3. Format: use sudo mkfs.ext4 /dev/sdb1 (e.g. the ext4 filesystem); always back up data before operating. 4. Temporary mount: create a mount point with sudo mkdir /mnt/mynewdisk, then mount with sudo mount /dev/sdb1 /mnt/mynewdisk. 5. Permanent mount: get the UUID with sudo blkid, edit /etc/fstab to add an entry (format: UUID mountpoint ext4 defaults 0 0), and verify with sudo mount -a. Key point: partition, format, mount, persist. Back up data before operating and use umount to unmount.

Read More