Tuesday, April 1, 2014

wtmpx data file Huge size + solaris

Hi Friends,

/var/adm/wtmpx  is a file, which keeps login details of the users and also carries shutdown, reboot of the server details. We faced File system full issue due to it. Our File system was total of size 15 GB, and the wtmpx file was occupying 12 GB of space and there were some other files which were occupying few spaces in MBs.

 and we were also not having space on other LVs, so that we could move the wtmp file and then compress the same. We could not stop the wtmp file logging.

a. We copied the same in text format using below command on /temp.

#/usr/lib/acct/fwtmp "<" /var/adm/wtmpx ">" /temp/wtmp.txt (the first sign used is "less than" and the second sign used is "greater than". First one is used to read the content and second one is used to to fwd the content of wtmpx file to text file )

We can also use the last -f command to read the files utmp, wtmp, btmp. As these file types are data type so should not be read with vi, more, cat.
#
#last -f /var/adm/wtmp or
#last -f /var/log/wtmp


this copied the content of wtmp file in /temp/wtmp.txt. You can name this file as per your wish.

this wtmp.txt file size was around 4.8G as it copied all the content of wtmp file of 12 GB.

b. We can monitor the /temp File system and we can also tail -f /temp/wtmp.txt file to check whether the files is proper or not. Now we can read the file as well.

c. tar/ compress/gzip the file, I gzipped the file

#gzip /temp/wtmp.txt

the size of above file became 250MB approx.

d. Now truncate the /var/adm/wtmp file or pass null value to the same like

#> /var/adm/wtmp :- this doesnt kill the process, but it empties the file.

e. File system size reduced.

f. Now moved the wtmp.txt file back to /var/adm/


It was a good learning. the FS size reduced and /var was available for use.




Love Sharing
Amit Chopra




#

No comments: