Skip to content

Instantly share code, notes, and snippets.

@jaimehrubiks
Created July 16, 2019 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaimehrubiks/1863988be7b09b62ddc5336ff10554dd to your computer and use it in GitHub Desktop.
Save jaimehrubiks/1863988be7b09b62ddc5336ff10554dd to your computer and use it in GitHub Desktop.
Shrink XFS system on LVM (do as root, no sudo)
#!/bin/bash
cd
/bin/cp -rf /home/controller /tmp/
pkill -KILL -u controller
usermod -d /tmp/controller controller
fuser -km /home/
umount /home
lvremove -y /dev/centos/home
lvcreate -y -L 12G -n home centos
umount /home
mkfs.xfs -f /dev/centos/home
mount /home
/bin/cp -rf /tmp/controller /home/
usermod -d /home/controller controller
chown -R controller:controller /home/controller
chmod 700 /home/controller/.ssh
chmod 600 /home/controller/.ssh/authorized_keys
restorecon -R /home/controller
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment