Last active
August 19, 2016 15:16
-
-
Save marshyski/8091708 to your computer and use it in GitHub Desktop.
Boot Fedora 19/20/21 faster with out-of-the-box fine tuning.
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
#!/bin/bash | |
#Disable SELINUX | |
setenforce 0 | |
echo "SELINUX=disabled" > /etc/selinux/config | |
echo "SELINUXTYPE=targeted" >> /etc/selinux/config | |
#Disable IPv6 | |
echo "net.ipv6.conf.all.disable_ipv6=1" >> /etc/sysctl.conf | |
echo "net.ipv6.conf.all.accept_redirects=0" >> /etc/sysctl.conf | |
echo "net.ipv6.conf.all.accept_source_route=0" >> /etc/sysctl.conf | |
echo "net.ipv6.conf.default.disable_ipv6=1" >> /etc/sysctl.conf | |
echo "net.ipv6.conf.default.accept_redirects=0" >> /etc/sysctl.conf | |
echo "net.ipv6.conf.default.accept_source_route=0" >> /etc/sysctl.conf | |
sed -i 's/udp6/#udp6/' /etc/netconfig 2>/dev/null | |
sed -i 's/tcp6/#tcp6/' /etc/netconfig 2>/dev/null | |
#Disable startup-stuff | |
cd /lib/systemd/system | |
for i in fedora*storage* lvm2-monitor.* mdmonitor*.*; do | |
systemctl mask $i | |
done | |
for i in livesys livesys-late spice-vdagentd cups smartd firewalld atd; do | |
chkconfig $i off | |
done | |
for i in abrt*.service nfs firewalld remote-fs auditd.service avahi-daemon.* bluetooth.* dev-hugepages.mount dev-mqueue.mount \ | |
fedora-configure.service fedora-loadmodules.service fedora-readonly.service ip6tables.service \ | |
iptables.service irqbalance.service mcelog.service rsyslog.service sendmail.service sm-client.service \ | |
sys-kernel-config.mount sys-kernel-debug.mount; do | |
systemctl mask $i | |
done | |
for i in *readahead*; do | |
systemctl mask $i | |
done | |
#Skip grub timeout menu | |
sed -i 's/GRUB_TIMEOUT=5/GRUB_TIMEOUT=0/' /etc/default/grub 2>/dev/null | |
sed -i 's/set timeout=5/set timeout=0/' /boot/grub2/grub.cfg 2>/dev/null | |
sed -i 's/set timeout=5/set timeout=0/' /etc/grub2.cfg 2>/dev/null | |
grub2-mkconfig -o /boot/grub2/grub.cfg 2>/dev/null | |
# Timeout in seconds; syslinux uses 10ths | |
# 0 means wait forever, so instead we'll go with 1 | |
sed -i 's/^timeout 10/timeout 1/' /boot/extlinux/extlinux.conf 2>/dev/null | |
#Skip disk checks | |
sed -i 's/1 1/0 1/' /etc/fstab | |
sed -i 's/1 2/0 2/' /etc/fstab | |
#Disable finger printing | |
authconfig --disablefingerprint --update | |
#Turn up file descriptors for all users | |
ulimit -n 999999 | |
echo '* hard nofile 999999' >> /etc/security/limits.conf | |
echo '* soft nofile 999999' >> /etc/security/limits.conf | |
#Turn off defragging | |
echo "never" > /sys/kernel/mm/transparent_hugepage/defrag | |
echo "never" > /sys/kernel/mm/transparent_hugepage/enabled | |
#Only allow swapping around 80-90% CPU usage | |
echo "vm.swappiness=0" >> /etc/sysctl.conf | |
echo "kernel.randomize_va_space=1" >> /etc/sysctl.conf | |
echo "kernel.exec-shield=0" >> /etc/sysctl.conf | |
echo "vm.dirty_ratio=3" >> /etc/sysctl.conf | |
echo "vm.dirty_background_ratio=2" >> /etc/sysctl.conf | |
echo "vm.overcommit_memory=1" >> /etc/sysctl.conf | |
echo "vm.mmap_min_addr=4096" >> /etc/sysctl.conf | |
#Turn on TRIM and setup cronjob | |
yum install -y hdparm | |
if [[ `hdparm -I /dev/sda | grep TRIM` != '' ]]; then | |
sed -i 's|issue_discards\ =\ 0|issue_discards\ =\ 1|g' /etc/lvm/lvm.conf | |
echo '00 6 * * 7 /sbin/fstrim -v /' >> /var/spool/cron/root | |
fi | |
#Remove plymouth startup banner | |
yum remove -y 'plymouth*' hdparm | |
dracut -f | |
sysctl -p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Started At:
Startup finished in 402ms (kernel) + 891ms (initrd) + 6.188s (userspace) = 7.483s
Now:
Startup finished in 387ms (kernel) + 846ms (initrd) + 5.578s (userspace) = 6.813s