Skip to content

Instantly share code, notes, and snippets.

@jegj
Last active October 25, 2021 18:57
Show Gist options
  • Save jegj/eaeb65b6babf18d6f27fddea7e51e2a0 to your computer and use it in GitHub Desktop.
Save jegj/eaeb65b6babf18d6f27fddea7e51e2a0 to your computer and use it in GitHub Desktop.
Very handly to check partition with filled

Disk Common Handling

Detect big files

sudo du -hsx /* | sort -rh | head -n 40
# https://askubuntu.com/questions/266825/what-do-i-do-when-my-root-filesystem-is-full

For boot partition

Disk Manipulation

Detect read only mode

for fileSystem in $(find /proc/fs -name options);do fsName=`echo $fileSystem | cut -f1-5 -d'/'`;fsState=`grep "^rw\|^ro" $fileSystem|sed -e 's/rw/1/' -e 's/ro/0/'`;echo -e "FileSystem=$fsName,State=$fsState";done

LVM Handling

Detect partition is being used

sudo lsof /data

Drop cluster

pg_dropcluster --stop 9.4 main 

Common resize

umount /mnt/postgresql
lvremove /dev/pgdata_volgrp/pgdata
vgremove pgdata_volgrp
###Optional###
pvremove /dev/sde /dev/sdb1
###
vgextend lydata /dev/sde
vgextend lydata /dev/sdb1
lvresize -rl +100%FREE /dev/lydata/lvol0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment