$ nbdkit -f -v memory size=$(( 2**63-1 ))
On the same machine:
# modprobe nbd # nbd-client localhost /dev/nbd0 Warning: the oldstyle protocol is no longer supported. This method now uses the newstyle protocol with a default export Negotiation: ..size = 8796093022207MB Connected /dev/nbd0 # sgdisk -n 1 /dev/nbd0 Creating new GPT entries in memory. The operation has completed successfully. # gdisk -l /dev/nbd0 Number Start (sector) End (sector) Size Code Name 1 1024 9007199254740973 8.0 EiB 8300
You can then try fun things like creating massive XFS filesystems.
A few caveats:
- You must be using kernel ≥ 4.18. Earlier kernels had a bunch of bugs in the Linux NBD driver.
- You must apply this fix for this bug in the nbd-client program. I have updated the Fedora packages so make sure you get the latest update from Fedora updates-testing.
- You will need nbdkit ≥ 1.6 which has support for sparse memory-backed huge disks.
I think it’d be interesting to integrate this into filesystem test suites. Unfortunately use of the Linux NBD kernel driver needs root 😦