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

Posted: November 23, 2016. At: 11:40 PM. This was 10 months ago. Post ID: 2605

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.

[email protected]:~# 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.

[email protected]:~# 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.

[email protected]:~# swapon swafile

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

[email protected]:~# swapoff swafile

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

[email protected]:~# free
             total       used       free     shared    buffers     cached
Mem:       5915844    5875940      39904          0    1950988    3376980
-/+ buffers/cache:     547972    5367872
Swap:      5036020          4    5036016
[email protected]:~#

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

[email protected]:~# free
             total       used       free     shared    buffers     cached
Mem:       5915844    5848000      67844          0    1942792    3358896
-/+ buffers/cache:     546312    5369532
Swap:      4511736          4    4511732
[email protected]:~#

No comments have been made. Use this form to start the conversation :)

Leave a Reply