SOLVED partitioning pool of mirrored nvme drives

Joined
Jan 27, 2020
Messages
577
Just to be super sure...I'd like to have the iocages and VM zvols on the same mirror of 2x 1TB NMVE drives (Thanks, @Patrick M. Hausen for the inspiration) :wink:

I found this handy guide through the process in the legacy sub-forum which for my plan condenses into these simple steps:

# wipe contents
gpart destroy -F /dev/nvme0
gpart destroy -F /dev/nvme1

# setup gpt partitioning scheme
gpart create -s gpt nvme0
gpart create -s gpt nvme1

# add swap partition at first available offset
gpart add -s 16g -t freebsd-swap -l swap0 nvme0
gpart add -s 16g -t freebsd-swap -l swap0 nmve1

#add partitions
gpart add -s 500g -t freebsd-zfs -l jails0 nmve0
gpart add -s 500g -t freebsd-zfs -l jails1 nmve1
gpart add -s 500g -t freebsd-zfs -l vm0 nmve0
gpart add -s 500g -t freebsd-zfs -l vm1 nmve1

Is this a no-no or am I good?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
And why exactly would you need to partition the drives? Just create a single pool and activate it in iocage. All iocage/jail data will be under <poolname>/iocage. Then create a dataset named <poolname>/vms and create all VM zvols there.

ZFS is a volume manager precisely to get rid of fixed partitioning.
 
Joined
Jan 27, 2020
Messages
577
And why exactly would you need to partition the drives? Just create a single pool and activate it in iocage. All iocage/jail data will be under <poolname>/iocage. Then create a dataset named <poolname>/vms and create all VM zvols there.

ZFS is a volume manager precisely to get rid of fixed partitioning.
Huh...I somehow assumed that iocage needs exclusive use over one pool...At least that's how I always set up my jails storage...
Well, even better to not have to fiddle around with gpart.
Thanks Patrick!
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
I was thinking why do you need to create a SWAP partition? You already have SWAP partitions by default on the pool you created. Maybe I'm missing something obvious? In reality if you have enough RAM, I didn't think you needed SWAP partitions at all. I recall one of my first FreeNAS systems having set the SWAP partition to zero which forced the software to not create it. It was a time I played with FreeNAS quite a bit. Maybe that has changed with the current software?
 
Joined
Jan 27, 2020
Messages
577
Frankly I did not thought that through. It was the first thing that came up searching for partition big disks into 2 pools. Thankfully Patrick cleared that up.
I believe you're right, creating pools through the gui sets everything up incl. swap partition. If it is needed? I do not know.
But what happens if you run out of RAM and have no swap available? data loss? eek
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
But what happens if you run out of RAM and have no swap available? data loss? eek
I guess the system crashes? Not a good thing. This is why when I think someone it short on RAM, I ask them to look at the SWAP File size. If it's larger than a few KB then you know for sure you ran out of RAM. My system (allocated with 16GB RAM in VM) currently has 0 Bytes in SWAP. I have seen it in the past where it will be a few KB's, like 4KB or less. It's possible I ran out of RAM but I'm not positive about that. I have 8GB of Swap space (the system default is 2GB per drive), quite a lot and I would hope I never need it. I would just allocate more RAM to my VM to solve it.

EDIT: I just examined my Swap Space and looks like the data must be retained only for a year. I had a zero swap space use going back to Nov 21 2022, then the previous data is gone.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
I always greatly increase the swap space before creating my HDD pool, matching at least the amount of RAM I have in total. So 32 G memory, 2x mirror vdev --> 16 G swap on each disk.
Then for additional special vdevs or VM pools on SSDs etc. I temporarily set the swap size to 0, create the additional pool or vdev, then back to e.g. 16 G. I found that if you leave it at 0, TrueNAS will not activate the already created swap space at boot time. So make sure to always set it back.

The setting is in System > Advanced.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
I found that if you leave it at 0, TrueNAS will not activate the already created swap space at boot time.
Well crap, that is a very interesting tid-bit of information. I wouldn't have guessed that. Thanks for sharing.
 
Joined
Jan 27, 2020
Messages
577
EDIT: I just examined my Swap Space and looks like the data must be retained only for a year. I had a zero swap space use going back to Nov 21 2022, then the previous data is gone.
Where/How do I check that?
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
Reporting -> Memory -> Swap Utilization
 
Top