Created
November 29, 2019 01:47
-
-
Save KlausEverWalkingDev/eee58677baa1722784d9557bcb67b84b to your computer and use it in GitHub Desktop.
Ativando zram no Arch Linux (pode funcionar em outras distros)
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
#Name: Ativando zram no Arch Linux (pode funcionar em outras distros) | |
#By KlausDevWalker | |
#Version: N/D | |
#Release Date: November 28th, 2019 | |
#!/usr/bin/bash | |
ATIVANDO ZRAM NO ARCH LINUX (PODE FUNCIONAR EM OUTRAS DISTROS) | |
#Adiciona módulo zram | |
echo zram > /etc/modules-load.d/zram.conf | |
#Indica quantos dispositivos zram serão criados | |
echo "options zram num_devices=4" > /etc/modprobe.d/zram.conf | |
#Configura o nome, tamanho e comando para criar os dispositivos | |
echo 'KERNEL=="zram0", ATTR{disksize}="4G" RUN="/usr/bin/mkswap /dev/zram0", TAG+="systemd"' > /etc/udev/rules.d/99-zram.rules | |
echo 'KERNEL=="zram1", ATTR{disksize}="4G" RUN="/usr/bin/mkswap /dev/zram1", TAG+="systemd"' >> /etc/udev/rules.d/99-zram.rules | |
echo 'KERNEL=="zram2", ATTR{disksize}="4G" RUN="/usr/bin/mkswap /dev/zram2", TAG+="systemd"' >> /etc/udev/rules.d/99-zram.rules | |
echo 'KERNEL=="zram3", ATTR{disksize}="4G" RUN="/usr/bin/mkswap /dev/zram3", TAG+="systemd"' >> /etc/udev/rules.d/99-zram.rules | |
#Adiciona entradas ao fstab | |
echo '/dev/zram0 none swap defaults 0 0' >> /etc/fstab | |
echo '/dev/zram1 none swap defaults 0 0' >> /etc/fstab | |
echo '/dev/zram2 none swap defaults 0 0' >> /etc/fstab | |
echo '/dev/zram3 none swap defaults 0 0' >> /etc/fstab | |
# Ativa todos os swaps | |
sudo swapon -a | |
# Confirmar se os dispositivos zram foram criados e ativados | |
zramctl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment