$ cat bigcore.c
#include
#include
int main(void) {
int fd = open("core", O_CREAT|O_WRONLY|O_TRUNC, 0600);
lseek(fd, 0x12345678, SEEK_SET);
write(fd, "1", 1);
close(fd);
return 0;
}
$ cc -o bigcore bigcore.c
$ ./bigcore
$ ls -l core
-rw------- 1 dmr staff 305419897 May 1 03:50 core
$ du -k core
48 core
$
A unique blog for Unix, Linux based Tips, tricks and Shell Scripts. This is intended to be one-stop Information Center for all your Unix, Linux needs.
Monday, July 28, 2008
sparse files
Due to the Unix concept of sparse files, you can create seemingly enormous files that in reality take next to no disk space. The following program will create a 305,419,897 byte file called 'core' that may result in you receiving a 'cleanup' email message from a less-than-seasoned Unix sysadmin even though it occupies virtually no real disk space.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment