-1

Page 301 of Tanenbaum's Modern Operating Systems contains the table below. It gives the file sizes on a 2005 commercial Web server. The chapter is on file systems, so these data points are meant to be similar to what you would see on a typical storage device.

File length (bytes) Percentage of files less than length
1 6.67
2 7.67
4 8.33
8 11.30
16 11.46
32 12.33
64 26.10
128 28.49
... ...
1KB 47.82
... ...
1 MB 98.99
... ...
128 MB 100

In the table, you will see that 6.67% of files on this server are 1 byte in length. What kinds of processes are creating 1 byte files? What kind of data would be stored in these files?

Mark Wallace
  • 528
  • 2
  • 12

1 Answers1

0

I wasn't familiar with that table, but it piqued my interest. I'm not sure what the 1-byte files were at the time, but perhaps the 1-byte files of today can shed some light?

I searched for files of size 1 byte with

sudo find / -size 1c 2>/dev/null | while read line; do ls -lah $line; done

Looking at the contents of these files on my system, they contain a single character: a newline. This can be verified by running the file through hexdump. A file with a single newline can exist for multiple reasons, but it probably has to do with the convention of terminating a line with a newline.

There is a second type of file with size 1 byte: symbolic links where the target is a single character. ext4 appears to report the length of the target as the size of the symbolic link (at least for short-length targets).

Sagar
  • 1,617
  • 9
  • 17