Will FreeNAS work fine with RAIDZ1 without Swap File?

Status
Not open for further replies.

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
So I'm curious if FreeNAS will work properly if there is no SWAP file present.

Currently when you create a pool (Volume) it creates a swap file of 2GB (default) for each drive. This can be reduced to 1GB via the GUI before creating the pool.

I have read concerns about the swap file in that the swap file is made up of all the swap partitions on each drive and is treated as a single partition in that should the swap file be in use and a single hard drive failure should occur, the swap file would be broken/corrupt because some of the data is no longer accessible. I have been unable to test this myself since I have been unable to get my system to use the swap file.

My question is, if I create a pool through the CLI, without creating a swap partition, will FreeNAS realize there is no swap file and function properly or will it crash thinking there is a swap file present? I know it can import pools that were not created with the GUI so I assume not all pools have a dedicated swap partition.

Maybe understanding the swap file more would help, and I don't mean it's function but how the software detects it and utilizes it. Details.
 
Joined
May 27, 2011
Messages
566
personally i Hate the idea of having a small swap partition at the start of the drive. mainly because if it's used, the read heads have to swing all the way to one end of the disk. i'd much rather have a diffrent solution.

but to answer your question, one of my pools was created under freenas 7.2 and does not have the swap partitions. i have not noticed a problem yet.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
Matt,
So you have a swap file in another pool? Have you actually seen your swap file in use?
 
Joined
May 27, 2011
Messages
566
i have not seen it used and I'm 90% sure that i have had at one point only my pool without the swap partitions on it.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
I sent an email to Josh, one of the developers and hopefully he will be able to shed some light on any adverse reactions if there is no swap space. I can see an issue if I were to run out of memory of course which might happen when UPnP gets enabled. If I could upgrade to 8GB RAM, I would but the cost of DDR2 RAM is too high and I would need to purchase two 4GB sticks. I'll have to see how this works out, so far so good. I'll wait on an answer from Josh before I recreate my pool without a swap file.
 

TwinDaddyKev

Dabbler
Joined
Jul 20, 2011
Messages
27
joeschmuck,

Have you got a response from Josh regarding the swap space?
Did you create a new pool without a swap partition?
I am thinking of doing the same thing on my rig.
Just want to know if it's a waste of space to have the swap partition.

TDK
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
The swap space values have been changed to allow you to adjust them any way you want. It was recommended to keep some swap space, in case something happens which consumes too much of your RAM, you have an out. I reduced my swap space to 1GB per drive. It's a very small amount of space compared to 2TB drives. There are pros and cons to using or not using the swap space and if I were running 8GB of RAM, I would get rid of the swap space but that is just me. Keep in mind any add-ons that you may desire down the road, like transcoding video for instance.

The reason I'd get rid of the swap space because having the swap space spread over all drives seams foolish. Place it on one drive, not all the drives. I know that all drives will lose the same space but at least if a drive crashes it doesn't take out the entire swap file system.

I don't think you will have any problems running without the swap file provided you have 8GB or more RAM, which is basically what I have (4GB RAM, 4GB Swap). BTW, I haven't used my swap file at all.

Hope this helps.
 

Durkatlon

Patron
Joined
Aug 19, 2011
Messages
414
I thought I always read that "ZFS likes to use whole disks", as a recommendation to not try to partition your disks before laying a ZFS filesystem on them. This whole 2GB swap on each disk seems to kind of run counter to that recommendation as well. I wish I had set up my ZFS from the CLI and not have these useless swap partitions on all the disks. I figure on a machine with 8GB of RAM, if it needs to use swap something is probably wrong and the machine will likely soon crash when it runs out of swap (which on my system is only 2x2GB, i.e. only half the physical RAM).
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
I want 8GB of RAM but two 4GB sticks is way too much. Maybe in a year or so when they become obsolete. I could just by another MB which would be cheaper since I have 8GB DDR3 RAM. DDR3 MB that also can use my CPU are not that plentiful nor cheap.
 

TwinDaddyKev

Dabbler
Joined
Jul 20, 2011
Messages
27
What is the CLI command to create a Raidz2 zfs pool with 1GB or no swap? I create it in the GUI but there is no option to change the swap size.
Having a 4GB ram and a 12GB swap seems like a waste of space.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
I don't know how to shrink the swap space. I ended up just reformatting my drives. Right now I can do that at any point in time because my FreeNAS is still in development stage, in other words I'm using it but there is a complete duplicate of data on my primary NAS device to which my FreeNAS unit will end up replacing.

And I agree, 12GB of swap space is a bit much. If you use the NAS properly you should not fill up your NAS. I don't recall the rule of thumb of free space to maintain, I think it's something like 15%, maybe a little more, leaving room for the ZFS file system to run properly. My point is the 12GB will hopefully not cause a problem for you and if at some point you need to reformat the drives, you could take care of it then. Maybe there is a way to reduce the swap partition, if you find it please share it. I'm certain that changing the swap partition (shrinking or growing) will be needed by someone.
 

TwinDaddyKev

Dabbler
Joined
Jul 20, 2011
Messages
27
I found the setting to reduce the swap size to 1GB. I thought I could do it while creating the pool in the GUI but the setting is in System, Settings, Advanced.
I blew away my pool since it's still in development stage and recreate the pool in the GUI with 1GB swap per drive. I can live with 6GB of swap versus 12GB.
My other Freenas running 8.01 Beta 4 is running with 8GB swap with 8GB physical memory and it shows that at one point it was using 13.6MB of swap space which to me is interesting. I will probably backup that data onto the new one and redo everything with 1GB of swap space per drive.
 

peterh

Patron
Joined
Oct 19, 2011
Messages
315
freenas and (no)swap

Ive stumbled over a design issue with freenas. Swap is allocated across all storage-disk !
While spreading swap across several disk is considered A Good Thing, there is
a very good case not to place swap on zfs volumes.
The reason i do not want swap is that zfs deals with whole disks, it may work with
partitions bit then it should be visible in the GUI and documentation that
not the whole disk is used but rather a slice/partition.
But the really nasty thing is the following scenario :
system is running, some swap is used, evenly distributed across all swap-areas.
Then a disk fails. While zfs will deal with this and if hardware allows will
make on-line replacement of a failed disk possible. But if part of the disk is
used for swap the system will not work well if this disk is replaced. Even worse
if replacing will succedd there is a risk that additional swap will overwrite what's
been written on the replacement disk.

I don't have any clear answars what to do instread, but would like the swap
logic to be moved to it's own part of the gui with the possibility to :

1- use a dedicated disk for swap
( could be a second memory-stick )
2 - use no disk for swap ( yes it's somewhat risky)
3 - use filesystem swap ( don't know the current status in freebsd, but it
certenly is no good in linux or other un*x-es dur to speed concern
4 -partition the "storage-disks" and use part of them as swap, this actually will
prevent hot-swap of storage but allow the current setup to be used.


Regards
Peter h
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
Peter, there is already a topic started about this. I'm going to move your post there.
 

peterh

Patron
Joined
Oct 19, 2011
Messages
315
I know ( and have read the thread about "will freenas work with zero swap" )
I wanted to discuss and possibly change the current swap implementation thus
interest those that already read the previous thread ( and have stopped reading
that thread thinking it was already discussed).
 

dalex

Dabbler
Joined
Oct 13, 2011
Messages
15
I have much much more than 8 G ram, so i set the swap at 0 (no swap).

But when a pool is created from gui, it still has one slice: /dev/da0p1, da1p1, etc.

If i built the pool from cli, (zpool create) using whole disks (/dev/da0, etc.) the pool works but freenas is unaware of it...

The suggestion of "whole disks", isn't supposed to mean exactly this? Plain da0 ? Or maybe is the same in performance terms ?
 

Durkatlon

Patron
Joined
Aug 19, 2011
Messages
414
If i built the pool from cli, (zpool create) using whole disks (/dev/da0, etc.) the pool works but freenas is unaware of it...
Yes the current swap design is ill-conceived. If you have a pool made from whole disks that you constructed in the CLI you should be able to import it from the GUI. I have done this successfully in the past. I really wish I could redo my ZFS at this point so it would use whole disks as well. Too much of a pain in the butt to have to copy all the data over again though... :(
 

dalex

Dabbler
Joined
Oct 13, 2011
Messages
15
If you have a pool made from whole disks that you constructed in the CLI you should be able to import it from the GUI. I have done this successfully in the past.(

Unfortunately, it's not working. Just entered

zpool create -m /mnt/data data mirror /dev/da0 /dev/da1

got (zpool status)

-------------
pool: data
state: ONLINE
scrub: none requested
config:

NAME STATE READ WRITE CKSUM
data ONLINE 0 0 0
mirror ONLINE 0 0 0
da0 ONLINE 0 0 0
da1 ONLINE 0 0 0

errors: No known data errors
----------

and GUI shows nothing there...
 

dalex

Dabbler
Joined
Oct 13, 2011
Messages
15
You are right of course.

It worked.

The only odd is that in the [view disks] screen, da0 has no name and "Unknown serial", although da1 says name=da1 and serial=WD-WMA...

Otherwise dataset creation and sharing seems working ok.
 
Status
Not open for further replies.
Top