WSL icon indicating copy to clipboard operation
WSL copied to clipboard

Zero /var/log/lastlog

Open fpmurphy opened this issue 10 years ago • 2 comments

When you install WSL, /var/log/lastlog has a size of 292292 but no actual contents. Disk space can be saved by simply creating an empty /var/log/lastlog at installation.

fpmurphy avatar Jul 03 '16 07:07 fpmurphy

Interesting. This file is present in the .tar.gz that Canonical provided us, I'm curious why it's there, since it's all zero'd it essentially takes up no space in the .tar.gz.

We like to run the image they provide us as-is so I'm hesitant to change this, but thank you for the suggestion!

benhillis avatar Jul 21 '16 15:07 benhillis

Well, /var/log/lastlog is supposed to be a sparse file so deleting it would normally not save space. See: http://www.noah.org/wiki/Lastlog_is_gigantic

However, this brings up another issue. If I do this:

dd if=/dev/zero seek=292291 count=1 bs=1 of=foo.txt

I expect this:

$ du -h foo.txt
4.0K    foo.txt

not this (what I'm seeing in WSL):

$ du -h foo.txt 
288K    foo.txt

So the real issue here is that sparse file support is not in place.

bogen avatar Sep 17 '16 16:09 bogen