bruce said the following on 05/06/2013 08:01 AM:
i know /run is a new cross-distribution location for the storage of transient state files, and /var/run is replaced by /run. but 1, why /var/run still have contents just as the same as /run ? just for backward compatibilty ?
2, if a program want to write some data to /run, is it supposed to write the same data to /var/run ?
3, it seems /var/run is not a symlink to /run, so /var/run occupy harddisk space, just like /run does?
You may be missing something, but I'm not sure what. Try running ls -li /run /var/run That will list the inodes as well as the dates and times and sizes. Oh look! They are the same in both directories. What can that mean? That they are the same files? How is that possible without a symlink? Well when I run # ls -ldi /run /var/run 2377 drwxr-xr-x 22 root root 720 May 6 05:17 /run 2377 drwxr-xr-x 22 root root 720 May 6 05:17 /var/run Oh, look, they are the same inode. This is a 12.3 system Hmm # mount | grep run tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755) tmpfs on /var/run type tmpfs (rw,nosuid,nodev,relatime,mode=755) No, I don't think /var/run is occupying hard disk space just like /run. One Upon a time someone wrote a file system driver for the V7 PFDPD-11, I think it was David Tilson, that migrated the first few blocks of the disk, that meant the superblock and inodes, into memory but left the data on disk. In that context, pre networking pre FFS, memory maxing out at 4Meg, it offered an improvement for the roll-in/roll-out applications like compilers that made heavy use of temp files. Now we have virtual memory, much larger memory, inode caching, name path caching and very fast file systems. The arguments for tmpfs have a lot to do with volatility. In effect these file systems are not very active, not like the compiler intermediate files that Dave Tilson was trying to optimise for. The tmpfs makes use of swap; if this memory is not accessed it get on the page-out queue. Its never going to take up space on the file system part of your disk. The "if a program want to write some data to /run" should not be taken in a wide context. As I said, this isn't a kind of buffer memory, compiler intermediate pass files, scratchpads and so forth. Looks what's there: pid files. How often will they get accessed? Sockets. Dynamically created unit files. How many of the files there are ovre few hundred bytes? Its all very constrained. If you want temporary files as in buffer files, working space, intermediate sort files, use /tmp --- oh and clean up after yourself! -- "Most victories came from instantly exploiting your enemy's stupid mistakes, and not from any particular brilliance in your own plan." -- Orson Scott Card, -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org