Adding swap partition to OS drive on s2 partition?

Status
Not open for further replies.

espenu

Cadet
Joined
Jan 23, 2012
Messages
3
I have FreeNAS installed on an old 30GB drive. When adding a zpool I added it through the CLI and chose not to have any swap space on them. Since I have 8GB of RAM I figured that should be enough.

However, when doing large file transfers (more than 100GB) to the raidz1 array, I still get some crashes that seem to be related to memory. I would therefore like to have some swap space for those occasions.
I don't want to use a SATA port just for swap, so I figured it could be placed on the main OS drive.
In the FAQ it's stated that it's possible to add more partitions. I was considering reorganizing and creating an extended partition so that it would be possible to add more, but since that's a bit of a hassle I started to see if I could just merge two of them or something similar.

After looking around I could not find any reference to partition number 2. So I set up a test system in virtualbox and tried deleting that partition and then creating a swap partition on the remaining 18GB of the drive, with partition index 2.
So far it looks like the system is working fine.

But before I try this on my primary system it would be really nice to know if partition number 2 is actually used for something that I have missed?
 

Stephens

Patron
Joined
Jun 19, 2012
Messages
496
I'm pretty sure I've read here Partition 2 is used for upgrades/rollbacks. So if you install FreeNAS initially, it goes to partition 1. When you do an upgrade, it goes to partition 2 and that's marked as the active partition. If your upgrade doesn't work, you can "roll back" to the previous version (partition 1) by selecting it during boot time (that's what the F1, F2, whatever thing is about during boot).

That said, the OS normally boots from a 2GB (ok, 4GB) stick, so even if you're using some of the partition in a way that's not stock, it may work as the space might not be used for anything else anyway. *I* wouldn't do it, but I'm still a noob. I like to keep things as closely to stock as the designers intended so if/when things go wrong, there's not a whole lot of customization people have to wade through in order to get to the root of my problems.
 

espenu

Cadet
Joined
Jan 23, 2012
Messages
3
Somehow I missed that partition 2 is used for upgrades. Thanks.
You have a good point when it comes to avoiding customization. But using the OS drive is the only practical way I can think of to get some swap space. Or maybe use a usb extension cable and run a cable from the rear usb ports and have a usb stick lying inside the case, then use that for swap.

I'll experiment with moving one of the partitions to an extended, and add swap as a logical. If it doesn't work, I'll just have to use the USB option.

Thanks for your help.
 

peterh

Patron
Joined
Oct 19, 2011
Messages
315
You could add an usb drive ( a real harddisk on usb ) and use for swap.
The initial test if it helps your case is to :
-add the drive, figure out what devicename it will get ( all done in a terminal window)
-partition the drive to contain a swap area ( only)
- enable swap to that area with swapon

and during usage swap usage mght be shown with pstat -s

If you find that you actually need swapdevice you could adjust your fstab to include the usb-disk
 
Status
Not open for further replies.
Top