Although, Linux is a very fast operating system providing the best speed as compared to other operating systems. As an open source operating system with Grub bootloader, you can make various changes to the boot loader that can speed up the booting process. The boot loader is a very sensitive component, so you need to change it very carefully.
The Grub Boot loader makes it very easy to start up the operating system. There are a few simple tweaks that you can perform to decrease the load time. Making changes to the Grub file is very dangerous if something goes wrong, you might face critical issues. So, make sure that you back up the Grub bootloader before continuing to this tutorial.
Backup Grub Bootloader
First of all, you need to launch the terminal using Ctrl + Alt + T or Ctrl + Shift + T on the keyboard and log in as the superuser i.e. root using the su or sudo -s command. After logging in as the Root Shell, use the CP command to make a copy of the Grub Bootloader.
cp /etc/default/grub/home/user-name/grub.bak
user-name should be the same as the Linux PC user name.
Customizing Grub Bootloader to Speed up the Boot Time
To speed up the boot time, you need to customize the GRUB_TIMEOUT setting. It is the idle time of the operating system. By default, it is 5 seconds, which is a considerable time. In case you want to speed up the boot time, you can change the number accordingly.
Enable Zswap on Linux
Now to change the boot speed, you need to customize the configurations file. Nano editor is the best application to edit the Grub configurations. To start editing get access as the superuser with su- or sudo -s. Now open the configurations file using the nano editor.
nano -w /etc/default/grub
Find out the GRUB_TIMEOUT entry and change the default entry i.e. 5 to a lower value. The smaller the number is, the faster Linux system will boot. For best results change the value to 0.
GRUB_TIMEOUT=0
In case you want to speed up the Grub then the best value is 2 seconds, so change the GRUB_TIMEOUT to 2
Now save the edit by Ctrl + O and close the editor by Ctrl + X.
The changes take effect when you update the file. Just gain the root access with sudo -s or su – command and follow the guide according to the Linux distribution.
Updating Grub in Ubuntu/Debian
update-grub
Updating Grub in Fedora/OpenSUSE
grub2-mkconfig -o /boot/grub2/grub.cfg
Updating Grub in Arch Linux
grub-mkconfig -o /boot/grub/grub.cfg
In case you want to go back to the previous changes and you are not happy with the changes you made to the Grub file then the best way is to restore the backup you previously created. This is done by few simple steps.
- Get root access with su – or sudo -s command.
- Go to the location where the backup is present i.e. /home/user-name/
cd /home/user-name/
- Remove the existing Grub file with rm command
rm /etc/default/grub
- Use the grub.bak file to the place using mv command
mv grub.bak /etc/default/grub
- Update the Grub so the changes can take affect
- Debian/Ubuntu
update-grub
- OpenSUSE/Fedora
grub2-mkconfig -o /boot/grub2/grub.cfg
- Arch Linux
grub-mkconfig -o /boot/grub/grub.cfg
- Debian/Ubuntu
You may also like to know HOW TO ENABLE VIRTUAL MEMORY ON LINUX TO IMPROVE PERFORMANCE