Linux & shell: Storage, mounts & LVM
10 Linux & shell commands: Storage, mounts & LVM. Click a command to see what each part does.
Linux & shell: Storage, mounts & LVMIndex
- Whole sheet251
- Navigate & list13
- Create, copy, move, delete13
- View & compare files9
- Permissions & ownership31
- Help & shell basics11
- Users & groups6
- Install packages7
- Package & software versions29
- System info9
- Network basics & SSH10
- Zip & compress4
- Shell operators6
- Processes6
- Files & search8
- Text processing pipelines4
- Disk3
- Network5
- Services & logs6
- Archives & copying4
- Firewall7
- Scheduling: cron & systemd timers6
- Storage, mounts & LVM10
- Kernel, hardware & limits8
- Performance & tracing10
- TLS & certificates8
- Packet capture & network debugging10
- Terminal tools8
Storage, mounts & LVM10
lsblk -fDisks, partitions and filesystemsWhat each part does
lsblkblock devices as a tree: disks, partitions, LVM volumes-fadd filesystem type, label, UUID and mount point
sudo mount <device> <mount-point>Mount a filesystemWhat each part does
mount <device>e.g. /dev/sdb1 or /dev/mapper/vg-data<mount-point>existing empty directory, e.g. /mnt/data
sudo findmnt --verify && sudo mount -aTest /etc/fstab before rebootingWhat each part does
findmnt --verifycheck fstab syntax, devices and filesystem typesmount -amount everything in fstab now; a typo here would otherwise stop the next boot
sudo umount <mount-point> || sudo lsof +f -- <mount-point>Unmount, and find what keeps it busyWhat each part does
umountunmountlsof +f -- <mount-point>processes with files open there (target is busy)
sudo mkfs.ext4 -L <label> <device>Create a filesystem on a new diskDestructiveWhat each part does
mkfs.ext4format as ext4 (mkfs.xfs for XFS): erases the device-L <label>filesystem label
sudo growpart <disk> <partition-number> && sudo resize2fs <partition>Grow a partition and filesystem after enlarging a cloud diskCautionWhat each part does
growpart /dev/xvda 1extend partition 1 to fill the disk (cloud-guest-utils)resize2fs <partition>grow an ext4 filesystem; for XFS: xfs_growfs <mount-point>
sudo pvs; sudo vgs; sudo lvsLVM overviewWhat each part does
pvsphysical volumes (disks in LVM)vgsvolume groups and their free spacelvslogical volumes and sizes
sudo lvextend -r -L +<size>G /dev/<vg>/<lv>Extend a logical volume and its filesystemCautionWhat each part does
lvextendgrow a logical volume-ralso resize the filesystem in one step-L +<size>Gadd this much (or -l +100%FREE for all free space)
swapon --show; sudo fallocate -l 2G /swapfile && sudo chmod 600 /swapfile && sudo mkswap /swapfile && sudo swapon /swapfileShow swap, and add a swap fileWhat each part does
swapon --showactive swap devices and usagefallocate -l 2G /swapfilecreate a 2 GB filechmod 600only root may read itmkswap / swaponformat it as swap and enable it (add to fstab to keep it)
df -iOut of inodes? (disk full with free space left)What each part does
df -iinode usage per filesystem; 100% means no new files even if space is free (millions of tiny files)
Nothing matches.
My DevOps Playbook by Angelo John Calleja