Posted: . At: 11:40 PM. This was 7 years ago. Post ID: 2605
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


Updating the grub2 boot-loader menu & adding swap space to your computer.


How to update the GRUB bootloader menu on Linux

To update the grub bootloader on your Linux box, this is another way to do this.

grub-mkconfig > /boot/grub/grub.cfg

This will update the grub2 bootloader and add any new kernels in /boot.

Creating a new swapfile for your Linux system.

Firstly we create a new file padded with zeros from /dev/zero.

root@deusexmachina:~# dd if=/dev/zero of=swafile bs=1024 count=524288
524288+0 records in
524288+0 records out
536870912 bytes (537 MB) copied, 2.20969 s, 243 MB/s

Then we enable the file as swap space with the mkswap command.

root@deusexmachina:~# mkswap swafile 
 
Setting up swapspace version 1, size = 524284 KiB
no label, UUID=f29c3acc-9deb-4213-9350-30cccc455f37

Finally, we enable the new swap space as a swap partition, making it available to the system.

root@deusexmachina:~# swapon swafile

To switch off this new swapfile, you may use the swapoff command to switch it off

root@deusexmachina:~# swapoff swafile

This is the output of the free command with the swapfile turned on.

root@deusexmachina:~# free
             total       used       free     shared    buffers     cached
Mem:       5915844    5875940      39904          0    1950988    3376980
-/+ buffers/cache:     547972    5367872
Swap:      5036020          4    5036016
root@deusexmachina:~#

And this is the output with the swapfile turned off with the swapoff command.

root@deusexmachina:~# free
             total       used       free     shared    buffers     cached
Mem:       5915844    5848000      67844          0    1942792    3358896
-/+ buffers/cache:     546312    5369532
Swap:      4511736          4    4511732
root@deusexmachina:~#

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.