How can I create a dedicated hard drive to do "swap"on a ubuntu 12.04 LTS?
You don't have to use a partition or hdd for swap.
Just create a swap file using
Create a file of filled with zeros 1GB in this case:
dd if=/dev/zero of=/mnt/swap.img bs=1M count=1024
Preferred method: use
fallocate instead of
fallocateis much faster than
ddbecause it quickly allocates blocks and mark them as uninitialized, no I/O to the blocks.
fallocate -l 1024M /mnt/swap.img
Format the file to create a swap device
Adding the swap to the running system:
Make it permanent, edit
/etc/fstab and add the following entry:
/mnt/swap.img none swap sw 0 0
More information: https://help.ubuntu.com/community/SwapFaq