STABLERESTART(5)
β¨ STABLERESTART(5) β¨
okay bestie, so this is a page from the File Formats Manual β yes it's literally called STABLERESTART(5), iconic of it β and it's all about the file that keeps your NFSv4 server from being dramatic on restart. let's get into it π
πΈ NAME πΈ
nfs-stablerestart β the restart info file for the NFSv4 server. that's it, that's the vibe π«Ά
π SYNOPSIS π
nfs-stablerestart
π DESCRIPTION π
so the nfs-stablerestart file holds the info that lets the NFSv4 server restart without always throwing the NFSERR_NOGRACE error at everyone. this is all described in the NFSv4 server spec, so if you want the receipts: see Network File System (NFS) Version 4 Protocol RFC 3530, Section 8.6.3. no cap π
the first record in the file β defined by struct nfsf_rec in /usr/include/fs/nfs/nfsrvstate.h β holds the lease duration of the last incarnation of the server, plus the number of boot times that follows. after that record you get the number of previous boot times that were listed in the first record. the lease duration is what sets the grace period β³. the boot times exist to dodge the unlikely situation where a boot time gets reused, which could happen if the TOD clock goes backwards. like, rude. this record, plus the previous boot times with this boot time added in, gets re-written at the end of the grace period. slay π
the rest of the file is appended records, defined by struct nfst_rec in /usr/include/fs/nfs/nfsrvstate.h, and they represent one of two things:
- records saying a client successfully acquired state π
- records saying a client's state was revoked π
the state revoke records mean that state info for a client got discarded β either because of lease expiry, or because a different client made an otherwise conflicting open or lock request. these records are how you figure out if clients might have hit either of those edge conditions.
and if a client might have hit either edge condition, or if this file is empty or corrupted? the server returns NFSERR_NOGRACE for any reclaim request from that client. no exceptions, bestie π
for the server to actually work correctly, you gotta make sure this file is written to stable storage by the time a write op with IO_SYNC specified has returned. that might mean disabling hardware-level caching for the local disk drive holding the file, or something similar. it's giving β¨persistenceβ¨
π¦ FILES π¦
/var/db/nfs-stablerestartβ the NFSv4 stable restart file, main character energy π/var/db/nfs-stablerestart.bakβ backup copy of the file, the supportive bestie π«Ά
π SEE ALSO π
nfsv4(4), nfsd(8) β go read those too, iykyk π
π BUGS π
if the file is empty, the NFSv4 server has literally no choice but to return NFSERR_NOGRACE for all reclaim requests. technically correct? yes. highly undesirable? also yes π so like, please don't lose this file if it's at all possible. the backup copy is maintained and used by nfsd(8) specifically to minimize the risk of that happening. team effort fr fr π«Ά
and bestie, listen: to move the file, you have to edit the nfsd sources and recompile it. yes, for real. this was done on purpose to discourage accidental relocation of the file. they really said "not on my watch" π
and that's the whole page! version vibes: this one's from Debian, dated April 10, 2011 β vintage but still serving π β¨π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2009 Rick Macklem, University of Guelph
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms