Creating a swap partition


Recommended Posts

I would like to understand how to do 2 things.  Would someone please explain them to me like I was a small child?  Don't leave any steps out, or assume I know anything.

 

How can I setup another flash drive to be used for dedicated swap?

 

How would I setup a hard drive for the same thing?

 

Don't leave out any details please?

 

Thanks,

Link to comment
  • 4 years later...

This is an old thread, but I had the same question and had to figure it out the long way.  I thought that I would share my process and results. 

 

First off I only have 1MB of memory installed and wanted to get a swap partition so it would stop killing my apps.  I simply installed a second USB stick (2MB) as I did not want a swap file on my unraid USB (swap files are hard on USBs over the long term (read/writes)).  I did not care about the add on USB stick since they are cheep although they may not be as fast.  Anyhow this method worked great and my system has a 2MB swap partition and now I can run many more addons.  Its been running for 2 months now with no issues.  I am using unraid version 5 RC-5.

 

1.  Need to find out what your USB stick name is... 

 

cat /proc/partitions

 

this will get a list of drives.  you just need to figure out what witch one is the USB.  I just looked for the 2MB one.

 

2.  Need to make a swap drive.  WARNING the -f will erase any drive that is put after the /dev/.  you,ve been warned!

 

mkswap -f /dev/"drive from above"  mine line was mkswap -f /dev/sdg

 

3.  Need to make your system use the swap partition.

 

swapon /dev/"drive from above"  so my line was swapon /dev/sdg

 

4.  now you can confirm that it is working by using "top" as it shows memory and all processes.  Note CTRL C to quit top.

 

top

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.