LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-08-2009, 02:30 PM   #1
bagpussnz
Member
 
Registered: Aug 2003
Posts: 54

Rep: Reputation: 15
/var/log/lastlog 400G - on a 300G filesystem!!


Hi,
I have a server running Ubuntu server 8.04. As the subject says, the /var/log/lastlog is about 400Gb.
I am going to delete it - as a file that size is unusable, but before doing so, I'd like to know how it's possible - as the root partition is on 300Gb in size.
(/var is under the root partition on this machine).

If I do a du -sh /var/log/lastlog - it says it's only 48k in size.
Ideas?

Cheers,
Ian.

Last edited by bagpussnz; 01-08-2009 at 02:37 PM.
 
Old 01-08-2009, 02:38 PM   #2
bagpussnz
Member
 
Registered: Aug 2003
Posts: 54

Original Poster
Rep: Reputation: 15
No worries. I turned my brain on - it's just a sparse fragmented file. I'll just delete it (after turning off syslog).

Ian.
 
Old 01-08-2009, 02:50 PM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I can think of two things. 1) the file is a sparse file with holes. 2) The file is opened for random r/w access and the filepointer is located way past the current end of the file but the file hasn't been written to yet.

Maybe another possibility is the file is opened r/w with a mmap function but due to update on access feature, the file which is treated as memory hasn't been updated due to the write on update feature which won't copy the memory until after it is written to.

A lastlog file that big is absurd, so maybe 32-bit signed offsets are used to manipulate the file, which have a 2-GB positive range, and you have found a bug somewhere.

You want to look at how in the world this file got this big. Either a bug, or maybe a denial of service attack, trying to fill up your filesystem. Maybe an attackers crude attempt to hide there tracks by making the lastlog file unreadable by increasing it size beyond what the "lastlog" command can access it. The lastlog file is binary or encrypted and so you can't simply use tail to examine it directly.

---

Update: I just checked the lastlog manpage.
Code:
The lastlog file is a database which contains info on the last login of
       each user. You should not rotate it. It is a sparse file, so its size
       on the disk is much smaller than the one shown by ls -l (which can
       indicate a really big file if you have a high UID). You can display its
       real size with ls -s.
So use "ls -s" to determine it's real size.
 
Old 01-09-2009, 01:30 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Quote:
I recently discovered that I have a one beer limit on LQ. After that my grammer & spelling suffer. Drat!
Written after >1 beer I take it
(s/grammer/grammar/)
 
Old 01-09-2009, 01:42 AM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Quote:
Originally Posted by chrism01 View Post
Written after >1 beer I take it
(s/grammer/grammar/)
Written after one beer and responding to a thread about bad spelling and grammar in posts!

I'm leaving it as is. It's a self reminder of a saying attributed to President Lincoln.
 
  


Reply

Tags
lastlog



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
/var/log/messages and /var/log/cron not working sigkill Linux - Software 6 08-09-2008 01:08 PM
Can Samhain log my entries in /var/log/secure and /var/log/mesage to a central server abefroman Linux - Software 2 04-13-2008 04:13 PM
/var/log/lastlog missing zQUEz Linux - Server 2 08-08-2007 07:38 PM
/var/log/packages and /var/log/setup sunny_5252 Slackware 4 05-17-2007 08:17 PM
/var/log/lastlog size ??? nabil Linux - General 0 10-09-2002 06:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration