[Solved!] A use case in which I'd actually be safe to TRIM array SSDs, but... can it be done? [it can!]


Recommended Posts

Hey all,

I've been an unRAID user for a while now (2 servers on my office,really like unraid's blend of NAS and "hypervisor" ) and lately I've been toying with the idea of using it for my 64Gb 16c Threadripper workstation (tested the whole GPU passthrough last weekend and it seems to work great) and I could really use the VMs/Containers for my particular development needs ...

I hit a little snag in planning and would love some input from you guys, here it goes:

I currently have several SSDs on this machine (An optane pci-e drive (currently used for boot), couple of m.2s , and some SATA drives) , and a single mechanical drive...all unmatched... I was thinking of my options :
 

  • A raid1 btrfs cache pool with all drives seemed like a waste (since any VMs would be backed up daily to my other servers (and rcloned to my remote backup)) and these drives have huge differences in performance
  • A raid0 btrfs cache pool doesn't seem right either (since the drives have difference performance...)
  • Maybe a combo of the optane as cache drive and others as UD...but this would limit me in the way I wanted to use unraid shares
     

But then it hit me... since I don't need parity , could I just create an SSD array with my unmatched drives ? Since there's no parity to be messed up could I then TRIM these disks somehow so that I don't lose performance over time?


am I overthinking this? did I miss a more obvious solution? how would you do it?

Thanks


DS

Edited by Diego Spinola
Link to comment

Could you be more specific regarding each drive? Capacity, etc?

 

Only 1 drive is required in the array, the mechanical drive would be a good choice for that. All others could be Unassigned Devices. Or some combination of Unassigned and cache pool depending on specifics.

 

The main thing you lose by not having disks in the array is the ability to span folders, but sound like that isn't important since you want to work directly with the different disks anyway.

Link to comment
20 hours ago, Diego Spinola said:

But then it hit me... since I don't need parity , could I just create an SSD array with my unmatched drives ? Since there's no parity to be messed up could I then TRIM these disks somehow so that I don't lose performance over time?

You can but trim won't work, since it's been disabled for all array devices, even if there's no parity.

  • Like 1
Link to comment
On 7/13/2019 at 8:52 AM, johnnie.black said:

You can but trim won't work, since it's been disabled for all array devices, even if there's no parity.

Do you know why it wont work? if it is this just a quirk/check of unraid's implementation of the fstrim utility or is it some lower level check? if not could I just recompile a version without it? I'm guessing it's GPL isn't it(unless they completely rewrote the thing)? I can also imagine a workaround of stopping the whole array mounting each drive manually and trying to TRIM them to see whether their "is it an array drive check" could be fooled this way , that would also work for me since my workstation could be stopped every weekend (This I can actually test rather easily, will try)... 

Edited by Diego Spinola
Link to comment
On 7/13/2019 at 8:42 AM, trurl said:

The main thing you lose by not having disks in the array is the ability to span folders, but sound like that isn't important since you want to work directly with the different disks anyway.

I like the idea of the JBOD using UD...it's my failsafe option if I fail my quest to TRIM parity-less array drives

Currently I'm working with the following drives:

  • 1x nvme Very fast Intel 480Gb Optane PCI-E SSD 
  • 2x nvme256Gb Samsung M.2 EVO 960 SSD not as fast as the optane but quite fast
  • 1x nvme 1TB Crucial M.2 SSD 2280 Still faster than most SSDs
  • 2x 480Gb WD SATA SSDs WDC_WDS480G2G0A

  • 1x 480GB Kingston SATA SSD (slower and older)
  • 1x 1Tb HDD mechanical drive I just don't use anymore

I'm thinking that if I had the option of using SSDs on the array I'd keep the Optane as a cache drive (that would store all VMs and Containers roots) and just throw everything else (except the HDD) in the array and manage shares (exclusions) according to disk performances 


 

Edited by Diego Spinola
Link to comment

WARNING: anyone stumbling on this post in the future and thinking about doing this BE VERY CAREFUL, this SHOULD ONLY be considered on parity-less arrays , this operation WILL invalidate your parity if you were to use it on an array containing one or more parity drives... consider yourself warned

18 hours ago, Diego Spinola said:

I can also imagine a workaround of stopping the whole array mounting each drive manually and trying to TRIM them to see whether their "is it an array drive check" could be fooled this way , that would also work for me since my workstation could be stopped every weekend (This I can actually test rather easily, will try)... 

 

 

Well I tried it like this and it works! 😃

 

#!/bin/bash


CSRF=$(cat /var/local/emhttp/var.ini | grep -oP 'csrf_token="\K[^"]+')
curl -k --data "startState=STARTED&file=&csrf_token=${CSRF}&cmdStop=Stop" http://localhost/update.htm

echo "Stopping array"
sleep 5 #do we need to pool it? is the curl stop cmd async?

echo "Mounting..."
mount /dev/nvme2n1p1 /root/test/
echo "Trimming..."
fstrim -v /root/test/
echo "Unmounting..."
umount /root/test
echo "pause for array start"
sleep 5 

CSRF=$(cat /var/local/emhttp/var.ini | grep -oP 'csrf_token="\K[^"]+')
curl -k --data "startState=STOPPED&file=&csrf_token=${CSRF}&cmdStart=Start" http://localhost/update.htm

echo "array should be starting"

Stopping array
Mounting...
Trimming...
/root/test/: 910.1 GiB (977167618048 bytes) trimmed
Unmounting...
pause for array start

This is just a proof of concept, but yeah worst case scenario I could run a script similar to this once a week to stop the array and TRIM my array drives


Start/Stop array snipet from:

 

So aside from not working with parity, and not working on a started array (I'll grant you the aquaduct...)
can anyone see a problem with this method?

Edited by Diego Spinola
Link to comment
  • 1 year later...

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.