Optane as Swap Partition

Do you need special drivers to use Optane on Linux. Is it possible to do a Swap partition on the Optane drive or is it better to use a Swap file (because of the way Optane works).

I forget the (better) competitor to Optane, would that be more use considering it does not “mirror” anything.

I want to use NVME PCI x4 for a ‘temp’/‘tmp’ folder map AND Swap space.

Cheers

Paul

1 Like

well I just saw the updated storage episode, so if no drivers are needed, I am gonna stick a PCIE x4 NVME drive in my Raspberry Pi, and do a test with 8Gb of swap, building of GCC 7 or 8, which takes 60 mins on a 4G ARMv7 and closer to 48hrs with 1Gb, wish me luck :slight_smile:

3 Likes

How would you attach a pciex4 NVME to a raspberry pi?

(am I not getting a joke?)

6 Likes

For science(?)

1 Like

It would take a lot of work for science. :slight_smile:

I believe that PIs don’t have a pcie port.

External M.2 to USB casing?

Swap speed shouldn’t matter because you should never be actively swapping in the first place. General feeling these days is swapfiles are better than partitions.

You’re probably going to be limited in speed depending on the interface you use. You could technically use the USB 3.0 port but that’s much slower than PCIe and SATA. You’d be better off getting some cheap SSD and caging, but even then, you’ll have many problems as writing to an SSD via swap that often harms performance. MMC storage differs from how an SSD caches data even though both are technically deviations of flash storage thus using swap on an MMC device doesn’t have as many pains.

Personally, I’d fork the kernel, use Google’s zRAM commits, and forget about swap entirely. But that’s just me.

3 Likes

that only works for sata m.2

Both MMC and SSDs are NAND, but MMC tends to be much slower as SSDs typically use many striped NAND modules to maximize performance.

USB3 is much slower than NVME certainly, but it’s more than fast enough to run your OS. It’s actually pretty good.

Zippy that google zram neat but really cool to use that new persistent ram modules and create a ramdisk on it and then direct paging file/swap to this “disk”

2 Likes

I’ve set up a zram swap on a pi3b+ just the other day, I was building golang 1.12 on raspbian lite and was missing a small bit of ram which was making some of the tests fail.

I noticed later it ended up spiking with up to 400M of data in zram.

But I’ve been reading up on zswap not sure if that’s maybe a better option to get even more space.

There is usb 3.1 gen2 to nvme cards(i have one) but yeah not gonna work on a pie as usb 2.0 is slow AF (pretty sure the pie is still 2.0)

1 Like

I didnt even know this was a thing. How do you connect PCI to a pi?

The pi3 has USB3, actually.

Still not fast enough for nvme

Not for the full speed certainly, but more than enough to run an OS and the Rpi will bottleneck it anyway.

Is the idea of using a swap space like this (however it’s connected) because the system itself only has a set amount of RAM, and can’t be upgraded? I’m presuming a device with enough RAM isn’t available?

But then I guess a Pi like device woudn’t ship with more than like 4GB of memory

Actually no, it’s still 2.0, which means there’s still master/slave 125us polling cycle delay and optane over USB is still a waste - mx500 would probably perform no differently.

Zram was is useful on older less powerful hardware with spinning disks. In the old NAS hacking community (linkstations etc) it was always preferable to have 32-64mb of compressed swap than the whole 128mb available and swap to disk.

Usually the compression ratio was >2 so even with 64mb of zram the actual memory usage was >32mb.

In terms of a pi, anything that lower the amount of potential swap to SD card is preferable.

1 Like