Utils
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
http://astrader.net:3006/sem/Utils/raw/branch/main/Proxmox/TrimLCX/trim.sh
|
||||
|
||||
```bash
|
||||
wget -q -O trim_lcx.sh http://astrader.net:3006/sem/Utils/raw/branch/main/Proxmox/TrimLCX/trim_lcx.sh && chmod +x trim_lcx.sh
|
||||
```
|
||||
@@ -0,0 +1,5 @@
|
||||
### Trim Proxmox host and all unprivileged LXCs on node ###
|
||||
for i in $(pct list | awk '/^[0-9]/ {print $1}'); do
|
||||
echo "Trimming CT $i"
|
||||
pct fstrim $i --ignore-mountpoints
|
||||
done
|
||||
@@ -0,0 +1,35 @@
|
||||
### Trim Proxmox host and all unprivileged LXCs on node ###
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
### Path to FSTRIM
|
||||
FSTRIM=/sbin/fstrim
|
||||
|
||||
### Static list of volumes to trim
|
||||
# Proxmox host
|
||||
TRIMVOLS="/"
|
||||
|
||||
### Trim volumes
|
||||
# Trim static list
|
||||
for i in $TRIMVOLS; do
|
||||
echo "Trimming $i"
|
||||
$FSTRIM -v $i 2>&1 | logger -t "fstrim [$$]"
|
||||
done
|
||||
|
||||
# Trim all LXC containers
|
||||
for i in $(pct list | awk '/^[0-9]/ {print $1}'); do
|
||||
echo "Trimming CT $i"
|
||||
# $FSTRIM -v /proc/$(lxc-info -n $i -p | awk '{print $2}')/root 2>&1 | logger -t "fstrim [$$]"
|
||||
#echo $FSTRIM /proc/$(lxc-info -n $i -p | awk '{print $2}')/root 2>&1 | logger -t "fstrim [$$]"
|
||||
#pct fstrim $i
|
||||
fstrim -v /var/lib/lxc/$i/rootfs
|
||||
done
|
||||
# Trim all LXC containers
|
||||
for i in $(pct list | awk '/^[0-9]/ {print $1}'); do
|
||||
echo "Trimming CT $i"
|
||||
fstrim -v /var/lib/lxc/$i/rootfs
|
||||
done
|
||||
for i in $(pct list | awk '/^[0-9]/ {print $1}'); do
|
||||
echo "Trimming CT $i"
|
||||
pct fstrim $i
|
||||
done
|
||||
Reference in New Issue
Block a user