Created
November 19, 2022 15:38
-
-
Save aderumier/d06677cbb16602a9a4a3f6c5772028df to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/etc/udev/rules.d/90-resizefs.rules | |
----------------------------------- | |
ACTION=="change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", RUN+="/usr/local/bin/resizefs.sh" | |
/usr/local/bin/resizefs.sh | |
-------------------------- | |
#!/bin/bash | |
if [ -n "$DEVNAME" ]; then | |
if [ "$ID_FS_TYPE" == "ext4" ] || [ "$ID_FS_TYPE" == "ext3" ]; then | |
resize2fs $DEVNAME | |
fi | |
if [ "$ID_FS_TYPE" == "xfs" ]; then | |
MOUNTPOINT=`lsblk -o MOUNTPOINT -nr $DEVNAME` | |
if [ -n "$MOUNTPOINT" ]; then | |
xfs_growfs $MOUNTPOINT | |
fi | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment