From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,c9e08fb8bf7d00e X-Google-Attributes: gidfee84,public From: alan@nabeth.cxo.dec.com (Alan Rollow - Dr. File System's Home for Wayward Inodes.) Subject: Re: abnormal file size Date: 1995/05/17 Message-ID: <3pduae$c8o@nntpd2.cxo.dec.com>#1/1 X-Deja-AN: 102838699 distribution: world references: <3pd6fa$d73@news.uni-c.dk> organization: Digital Equipment Corporation reply-to: alan@nabeth.cxo.dec.com (Alan Rollow - Dr. File System's Home for Wayward Inodes.) newsgroups: comp.unix.osf.osf1 In article <3pd6fa$d73@news.uni-c.dk>, franck@dtbsun (Marianne) writes: > I hope somebody can help me with this. I have a file which looks like >it's 3.3GB on a 1GB disk. 'ls -l' give 3.3GB and whenever I try to copy, >backup, ftp the file it really come out as 3.3GB. The file is really 7MB >and 'du -k' give the right size. I've tried to fsck the disk without >success. Sounds like a sparse file, which is perfectly acceptable and considered by most, a feature. See the lseek(2) manual page for information about how such a file is created. Some database libraries will create such files; dbm(3) for example. The quota file is also such a file depending on the range of the user ids. Core files created from system crash dumps are also sparse files. When lseek(2) can be used to move past the end of the file. When data is written at the current offset, only the data for that offset is allocated. Space for the intervening data isn't. When this hole is read back it provides NULs. Most programs that move files around simply read the NULs and fill them in, which is why gets larger when you copy it. Dump/restore do the appropriate thing, since dump can see that no blocks are allocated. The dd(1) program has an option to convert NULs to appropriate holes; conv=sparse. > >Thanks for any hint, >Franck. > > -- Alan Rollow alan@nabeth.cxo.dec.com