Learn how to grow and shrink filesystems without losing data and how to avoid common pitfalls. 16.11.2025 | reading time: 2 min Resizing a filesystem is simple when done with a plan and the right commands; this guide shows practical steps to grow or shrink space while preserving data. A real case on LVM A VPS has root on LVM with 100G and the operator increased the virtual disk by 20G in the hypervisor; he follows these commands to apply the extra space and grow an ext4 root filesystem ``` # inspect current layout lsblk -f NAME FSTYPE LABEL UUID MOUNTPOINT SIZE sda ├─sda1 ext4 abcdef12-3456-7890-1234-567890abcdef /boot 512M └─sda2 LVM2_member 1111-2222-3333-4444 100G # notify kernel of disk change partprobe /dev/sda # expand the physical volume to use the new space pvresize /dev/sda2 # extend logical volume by 20G lvextend -L +20G /dev/vg0/root # grow an ext4 filesystem while mounted resize2fs /dev/vg0/root # check result df -h / Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg0-root 120G 40G 76G 35% / ``` Crucial gotchas Do not assume all filesystems behave the same; ext4 usually grows online while xfs grows online but cannot shrink, shrinking ext4 requires unmount and fsck, encrypted LUKS containers must be resized in the right order and snapshots or backups are essential before any shrink operation. Useful companion tools Use parted or fdisk to adjust partitions, pvresize and lvextend for LVM, resize2fs for ext2 ext3 ext4 and xfs_growfs for XFS; include e2fsck before shrinking and consider LVM snapshots or storage snapshots to protect data. Finish line Resize operations reward careful planning more than speed so test on a copy first and always keep backups; for structured study pursue deeper LINUX knowledge and consider certifications like CompTIA Linux+ or LPIC-1 and intensive exam preparation at bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. filesystem storage utilities backup troubleshooting