Skip to main content

Posts

Showing posts with the label UNIX

/var/log/lastlog is very big in size.

My backup team reported that the backups are failed. And on investigation I found /var/log/lastlog is very huge in size but file system usage is normal in "df" output.  And even "du" command also shows normal in size. I found this information from redhat. This file is what we call a sparse file. A sparse file is a file that contains unallocated blocks or "empty space", as it implies, it does not actually take up filesystem space. To test this theory, execute the following command: root@server1.nyc.us:/var/log # ls -l /var/log/lastlog -rw-r--r-- 1 root tty 459561084068 Jul 1 13:05 /var/log/lastlog root@server1.nyc.us:/var/log # du -sh /var/log/lastlog 23M /var/log/lastlog See the ls -l output, which shows huge size. The fix which they have suggested is to copy/move the file to some other place, because the copying will clear the unallocated blocks. But I found the copy is taking more time. So I decided to to clear the file after stopping th...

How to kill the tty sessions in unix

How to kill the tty sessions in UNIX 1. First you have to check how many logins are present in server.  Use "w" command to list all the sessions . [root@testserver ~]# w  00:22:13 up 106 days, 22:41,  2 users ,  load average: 3.31, 1.53, 1.09 USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT root     pts/15   master.world.com 00:22    1.00s  0.64s  0.61s w root     pts/18    10.47.18.111      09Mar14  36days  0.01s  0.01s -bash Total 2 users are logged in. See there is a session from the IP 10.47.18.111 is idle for last 36 days.  And I want to end this session.  For that we have to note down the tty id which is used for this Login. See here it is  pts/18 .  2....