NOCOW & swap-in-ram fix.
This commit is contained in:
parent
c5816896b2
commit
f7aa459015
|
|
@ -129,10 +129,16 @@ echo "-- Check for low memory systems <8G --"
|
||||||
echo "--------------------------------------"
|
echo "--------------------------------------"
|
||||||
TOTALMEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*')
|
TOTALMEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*')
|
||||||
if [[ $TOTALMEM -lt 8000000 ]]; then
|
if [[ $TOTALMEM -lt 8000000 ]]; then
|
||||||
dd if=/dev/zero of=/swapfile bs=1M count=2048 status=progress
|
#Put swap into the actual system, not into RAM disk, otherwise there is no point in it, it'll cache RAM into RAM. So, /mnt/ everything.
|
||||||
chmod 600 /swapfile
|
mkdir /mnt/opt/swap #make a dir that we can apply NOCOW to to make it btrfs-friendly.
|
||||||
mkswap /swapfile
|
chattr +C /mnt/opt/swap #apply NOCOW, btrfs needs that.
|
||||||
swapon /swapfile
|
dd if=/dev/zero of=/mnt/opt/swap/swapfile bs=1M count=2048 status=progress
|
||||||
|
chmod 600 /mnt/opt/swap/swapfile #set permissions.
|
||||||
|
chown root /mnt/opt/swap/swapfile
|
||||||
|
mkswap /mnt/opt/swap/swapfile
|
||||||
|
swapon /mnt/opt/swap/swapfile
|
||||||
|
#The line below is written to /mnt/ but doesn't contain /mnt/, since it's just / for the sysytem itself.
|
||||||
|
echo "/opt/swap/swapfile none swap sw 0 0" >> /mnt/etc/fstab #Add swap to fstab, so it KEEPS working after installation.
|
||||||
fi
|
fi
|
||||||
echo "--------------------------------------"
|
echo "--------------------------------------"
|
||||||
echo "-- SYSTEM READY FOR 0-setup --"
|
echo "-- SYSTEM READY FOR 0-setup --"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue