Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!decwrl!decvax!ima!cfisun!lakart!dg From: dg@lakart.UUCP (David Goodenough) Newsgroups: comp.unix.questions Subject: Re: Sparse Files ? Message-ID: <528@lakart.UUCP> Date: 2 May 89 16:01:03 GMT References: <30481@bu-cs.BU.EDU> Organization: Lakart Corporation, Newton, MA Lines: 27 madd@bu-cs.BU.EDU (Jim Frost) sez: ] mark@ria-emh2.army.mil (Mark D. McKamey IM SA) writes: ] | What is the definition of a "Sparse file" in the UNIX world? ] ] UNIX stores data in files by maintaining pointers to data blocks. By ] allocating only those blocks which have actually been written to, you ] can create files which appear to be larger than they actually are. ] These are usually created by lseek()ing and write()ing. ] ] When you create an empty file, the system allocates a file information ] block (called an inode) which contains a small list of block pointers. ] This list is initially blank. When we write into the file, the system ] gets data blocks and sets the appropriate block pointer to point to ] the block. Hummm - this sounds a bit like CP/M - obviously UNIX stuffs a lot more info into the inode than CP/M does into it's directory slot, but the method of a list of block numbers is exactly the same. Now for the $64000 question: what does UNIX do when it runs out of block number slots in the inode. I doubt it's the same as CP/M (which just allocates a second directory entry for the file, and sets a flag to show this is an extension). So how does UNIX handle very big files? -- dg@lakart.UUCP - David Goodenough +---+ IHS | +-+-+ ....... !harvard!xait!lakart!dg +-+-+ | AKA: dg%lakart.uucp@xait.xerox.com +---+