Friday, January 13, 2012

Finding bios version in linux servers

Command : dmidecode --type 0


[root@testsrv1 ~]# dmidecode --type 0
# dmidecode 2.7
SMBIOS 2.5 present.

CLEANING UP THE LINUX BUFFER CACHE

When you write data, it doesn’t necessarily get written to disk right then. The kernel maintains caches of many things, and disk data is something where a lot of work is done to keep everything fast and efficient.

That’s great for performance, but sometimes you want to know that data really has gotten to the disk drive. This could be because you want to test the performance of the drive, but could also be when you suspect a drive is malfunctioning: if you just write and read back, you’ll be reading from cache, not from actual disk platters.


Obviously the first thing you need to do is get the data in the cache sent on its way to the disk. That’s “sync”, which tells the kernel that you want the data written. But that doesn’t mean that a subsequent read comes from disk: if the requested data is still in cache, that’s where it will be fetched from. It also doesn’t necessarily mean that the kernel actually has sent the data along to the disk controller: a “sync” command is a request, not a command that says “stop everything else you are doing and write your whole buffer cache to disk right now!”. No, “sync” just means that the cache will be written, as and when the kernel has time to do so.

Note that you really didn’t even need the “sync” if this is what you are doing: the overwrite forces the sync itself.

Modern Linux kernels make this a bit easier: in /proc/sys/vm/ you’ll find “drop_caches”.

You can simply echo a number to that to free caches.

To free pagecache:
echo 1 > /proc/sys/vm/drop_caches

To free dentries and inodes:
echo 2 > /proc/sys/vm/drop_caches

To free pagecache, dentries and inodes:
echo 3 > /proc/sys/vm/drop_caches

clear swap space in linux

There have been times where it has been necessary for UNIX Admins to clear out the swap space on a Linux system. In order to do this, you must first make sure that you have enough free memory to hold what is being used by swap.


First we want to see what is currently being used.

free


Then I run the actual commands that empty the swap:

swapoff -a and then swapon -a


Then I check what is being used after doing this.

free

To check the login attempts to see if it needs to be reset

To check the login attempts to see if it needs to be reset type faillog -u

root@testsrv:~ # faillog -u user1
Username Failures Maximum Latest
user1 15 0

Reset the counter with the -r flag:

root@testsrv:~ # /usr/bin/faillog -r user1
Username Failures Maximum Latest
user1 0 0

Difference between ext3 and ext4

Features

1. Ext3 stands for third extended file system.

Ext4 stands for fourth extended file system.
Introduced

2. ext3 was introduced in 2001.

ext4 was introduced in 2008.

3. Kernel Support

ext3 Supports from Linux Kernel 2.4.15

ext4 Supports from Linux Kernel 2.6.19

4. Maximum individual file size supported

ext3 Maximum individual file size can be from 16 GB to 2 TB

ext4 Maximum individual file size can be from 16 GB to 16 TB

5. Maximum file system size supported

Overall ext3 file system size can be from 2 TB to 32 TB

Overall maximum ext4 file system size is 1 EB (exabyte).
1 EB = 1024 PB (petabyte).
1 PB = 1024 TB (terabyte).

6. Maximum sub directories

ext3 Directory can contain a maximum of 32,000 subdirectories

ext4 Directory can contain a maximum of 64,000 subdirectories

Other Features

The main benefit of ext3 is that it allows journaling.

Journaling has a dedicated area in the file system, where all the changes are tracked. When the system crashes, the possibility of file system corruption is less because of journaling.


There are three types of journaling available in ext3 file system.

Journal – Metadata and content are saved in the journal.

Ordered – Only metadata is saved in the journal. Metadata are journaled only after writing the content to disk. This is the default.

Writeback – Only metadata is saved in the journal. Metadata might be journaled either before or after the content is written to the disk.

In ext4, it supports journaling and also has the option of turning the journaling feature “off”.

Several other new features are introduced in ext4: multi block allocation, delayed allocation, Journal checksum, fast fsck and etc.

All you need to know is that these new features have improved the performance and reliability of the file system when compared to ext3.

Supports huge individual file size and overall file system size.


You convert ext2 to ext3 without having any data loss

You can also mount an existing ext3 fs as ext4 fs (without having to upgrade it).