User Tools

Site Tools


what_happened_to_my_space

What happened to my space?

Not to be confused with Myspace, it just kind of died on the vine, it couldn't keep up with the competition and then they deleted almost ten years worth of info.

Also, see Expanding a Filesystem LVM2/XFS

Got a pile of Nagios warnings about running out of space on a MySQL server at work, simplest to expand the space;

#  Status beforehand
df -h
# Filesystem                  Size  Used Avail Use% Mounted on
# devtmpfs                    7.8G     0  7.8G   0% /dev
# tmpfs                       7.8G     0  7.8G   0% /dev/shm
# tmpfs                       7.8G  793M  7.0G  11% /run
# tmpfs                       7.8G     0  7.8G   0% /sys/fs/cgroup
# /dev/mapper/almalinux-root   62G   47G   16G  76% /          <<< Warning about free space at 25% available
# /dev/sda1                  1014M  258M  757M  26% /boot
# /dev/mapper/almalinux-home   30G  246M   30G   1% /home      <<< Plenty of space here!
 
lsblk -fo name,fstype,mountpoint,size
# NAME               FSTYPE      MOUNTPOINT  SIZE
# sda                                        100G
# ├─sda1             xfs         /boot         1G
# └─sda2             LVM2_member              99G
#   ├─almalinux-root xfs         /          61.2G
#   ├─almalinux-swap swap        [SWAP]      7.9G
#   └─almalinux-home xfs         /home      29.9G
# sr0                                       1024M
 
cd /tmp
tar -czvf /tmp/HomeBackup.tgz /home/*
umount /home 
lvreduce -L 10GB /dev/almalinux/home # -L is final size
mkfs.xfs -f /dev/almalinux/home
mount /home/
cd /home/
tar -xzvf /tmp/HomeBackup.tgz
lvextend -l +100%FREE /dev/almalinux/root # -l is change in size
xfs_growfs /dev/almalinux/root
 
# Status afterward
lsblk -fo name,fstype,mountpoint,size
# NAME               FSTYPE      MOUNTPOINT  SIZE
# sda                                        100G
# ├─sda1             xfs         /boot         1G
# └─sda2             LVM2_member              99G
#   ├─almalinux-root xfs         /          81.1G
#   ├─almalinux-swap swap        [SWAP]      7.9G
#   └─almalinux-home xfs         /home        10G
# sr0                                       1024M
 
df -h
# Filesystem                  Size  Used Avail Use% Mounted on
# devtmpfs                    7.8G     0  7.8G   0% /dev
# tmpfs                       7.8G     0  7.8G   0% /dev/shm
# tmpfs                       7.8G  793M  7.0G  11% /run
# tmpfs                       7.8G     0  7.8G   0% /sys/fs/cgroup
# /dev/mapper/almalinux-root   82G   47G   35G  58% /          <<< No warnings now for a while!
# /dev/sda1                  1014M  258M  757M  26% /boot
# /dev/mapper/almalinux-home   10G  105M  9.9G   2% /home
what_happened_to_my_space.txt · Last modified: by steve