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; swapon
/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; swapon /tmp/swapfile

E.
mkswap /tmp/swapfile 512000; swapon /tmp/swapfile

Explanation:
See http://www.cyberciti.biz/faq/linux-add-a-swap-file-howto/
While Linux primarily expects a whole swap partition to be used, it works with files also.
Create a file big enough for your purposes, designate the file as swapspace (mkswap), instruct the
kernel to use the additional space (swapon).
Add the swapfile in /etc/fstab to enable swapping after the next reboot automatically.



Leave a Reply 0

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