which combination of commands should be used?

A system is running out of swap space. To initialise 5GB of additional swap space, which combination of commands should be used?

A system is running out of swap space. To initialise 5GB of additional swap space, which combination of commands should be used?

A.
dd if=/dev/zero of=/tmp/swapfile bs=1024 count=5120000; mkswap /tmp/swapfile; swap on /tmp/swapfile

B.
dd if=/dev/zero of=/tmp/swapfile bs=1024 count=5120000; swap on /tmp/swapfile

C.
dd if=/dev/zero of=/tmp/swapfile bs=1024 count=5120000; mkswap /tmp/swapfile; mount /tmp/swapfile

D.
touch -5G /tmp/swapfile; swap on /tmp/swapfile

E.
mkswap /tmp/swapfile 512000; swap on /tmp/swapfile

Explanation:

By Creating the image file, we can use as a Virtual Memory.
To use as a swap space:
1. Create the image file using dd command where if means input from and of means output filename. bs means byte sector and count means how many times to read.
2. mkswap command creates the swap filesystem
3. To on/off the swap memory: swapon swapfile and to off swapoff swapfile
4. Verify using free command



Leave a Reply 0

Your email address will not be published. Required fields are marked *