Return to BSD News archive
#! rnews 5035 bsd Path: euryale.cc.adfa.oz.au!platinum.sge.net!como.dpie.gov.au!news.gan.net.au!act.news.telstra.net!vic.news.telstra.net!news.mira.net.au!news.netspace.net.au!news.mel.connect.com.au!news.syd.connect.com.au!news.bri.connect.com.au!corolla.OntheNet.com.au!not-for-mail From: Tony Griffiths <tonyg@OntheNet.com.au> Newsgroups: comp.unix.bsd.freebsd.misc Subject: Re: Out of INODES (some further explanation) Date: Sat, 28 Jun 1997 11:58:45 +1000 Organization: On the Net (ISP on the Gold Coast, Australia) Lines: 92 Message-ID: <33B46FD5.5308@OntheNet.com.au> References: <01bc830e$a0ffc9f0$0f00a8c0@kahuna> Reply-To: tonyg@OntheNet.com.au NNTP-Posting-Host: swanee.nt.com.au Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.0 (WinNT; I) To: Kurt Schafer <kschafer@cyberbeach.net> Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:43663 Kurt Schafer wrote: > > I received an error that one of the directories I've got set up as a > repository for USENET articles is out of inodes. > > The drive is a 4gig barracuda of which 1.2gigs are taken up. But god knows > how many actual files and directories are hogging inodes. > > The machine is an INND server with the /var/news distributed amongst 4 4gig > drives via symlinks to different tree hierarchies. (alt rec, etc) > > Any pointers would be welcome. A bit more explanation of your problem (since I have been there, done that [several times!!!]) ... Basically, each file in a filesystem requires ONE (1) inode. A brief decription of an INODE: Each inode contains the metadata for the file (name, creation date, access date, owner & protection codes, etc.) as well a pointers (12) to the data blocks that the file occupies on disk. If the file is 'large' and occupies more than 12 data blocks, then a form of tree-structured chaining occurs with top-level pointers pointing to next-level pointer, etc. until you get to the actual data blocks themselves. If, for instance, the block size of the filesystem is 8KB (typical /usr setting), then a file of 96KB or less will have only direct pointers in the inode! So, we now come down to filesystem parameter settings (newfs) - -b block size in bytes (power of 2 from 512 -> ???) -f fragment size in bytes (1/1, 1/2, 1/4, 1/8 of -b value) -i inode density in bytes As stated before, the block is the largest amount of disk that each pointer can reference. Bigger blocks mean that fewer pointers are necessary. The 'fragment' is the "unit of allocation" for a filesystem and is some fraction of a block (1/8th being the smallest fraction). There is a single bit in the allocation bitmap for each frag in the filesystem. A fragment is that bit of a file at the end which doesn't occupy a complete block (eg. a 8193 byte file on a 8KB block'd filesys will occupy 1 whole block + 1 frag for the 1 extra byte). On average, 1/2 a frag is wasted per file. The inode density (-i value to newfs) determines how many inodes (128 bytes each) to create for the filesystem. If you choose a value of 4KB (1 inode per 4096 bytes of filesystem), then a 4GB filesystem will have 1,000,000 (or there abouts) inodes preallocated, and since each takes 128 bytes, roughly 128MB of the 4GB filesystem will be taken up by inodes. There is other 'overhead' as well, such as the storage bitmap for frag allocation but inodes represent the largest portion of the overhead! Remember that you need 1 inode per file so, depending on the AVERAGE file size, and number of expected files, you can calculate the number of inodes (+ some for comfort and peace of mind) you need for a particular filesystem. This is what I use for news allocated over 2 x 4GB disks... /var/spool/news -b 8192 -f 2048 -i 4096 /var/spool/news/alt -b 16384 -f 4096 -i 8192 On the basis of fewer+bigger file on the ".../alt" filesystem, I have made the blocks and frags bigger and allocated fewer inodes per bytes of filesystem. Remember that the frag is the smallest unit of allocation so, on average, 1/2 a frag is wasted per file created. Smaller frags mean less wasted space but bigger bitmaps to keep track of allocated space. There are other parameters to newfs such as "group size" and the like, but I generally let these default (32MB/group seems to be a favorite default). The metadata for each group is located at the front of the group. For gory details of any existing filesystem, use the command- # sync; sync; dumpfs /dev/rsd0e > /tmp/usr-fs.info ^^^^^ ^^^^^^^^^^^^^^^^ Your preferences go here! This will provide a summary of the filesystem followed by info related to each cylinder-group (blocks, directories, inodes, and frags). As for a solution to your "out of inodes" problem, as someone else said it's a matter of trashing the fs and newfs'ing with hopefully better parameters this time round. With news, it's relatively easy to get it wrong (several times in my case) and painful to fix each time you do! Tony