Category: Linux Administration

Feb 02 2011

How to know Linux machine is 32 or 64 bit?

How to know Linux machine is 32 or 64 bit?

# uname -m

i386 or i686 then it is 32 bit
x86_64 is 64bit

Jun 17 2010

How to Detect and Mount the CD-ROM in Linux

How to Detect and Mount the CD-ROM in Linux

1. Detecting CD-ROM/DVD-ROM drive
# wodim –devices

[lokesh@Mudhalvan ~]$ wodim –devices
wodim: Overview of accessible drives (1 found) :
————————————————————————-
0 dev=’/dev/scd0′ rwrw– : ‘HL-DT-ST’ ‘RW/DVD GCC-4243N’
————————————————————————-
[lokesh@Mudhalvan ~]$

2. Testing for iso9660 compatibility
# cat /proc/filesystems

3. Creating mount point
# mkdir /media/cdrom

4. Mounting CD
# mount -t iso9660 /dev/scd0 /media/cdrom/

5. Altering /etc/fstab
/dev/sdc0 /media/cdrom iso9660 ro,user,noauto 0 0

6. Unmount and eject CD
# unmout /dev/sdc0
# eject

Mar 04 2010

chkconfig – Linux Service Auto Start/Stop

chkconfig – Linux Service Auto Start/Stop

The chkconfig command can be used to activate and deactivate services. If you use the chkconfig –list command, you will see a list of system services and whether they are started (on) or stopped (off) in runlevels 0-6

# chkconfig
chkconfig version 1.3.30.1 – Copyright (C) 1997-2000 Red Hat, Inc.
This may be freely redistributed under the terms of the GNU Public License.

usage: chkconfig –list [name]
chkconfig –add
chkconfig –del
chkconfig [--level ]

1. chkconfig –list – will query any service in /etc/rc.d with each runlevel

$ chkconfig –list anacron
anacron 0:off 1:off 2:on 3:on 4:on 5:on 6:off

2. chkconfig –level <0/1/2/3/4/5/6> – Will be used to auto start/stop the service at each run level

chkconfig can be used to set a service to be started (or not) in a specific runlevel.

For example, to turn ntpd off in runlevels 3, 4, and 5, use the command:

chkconfig –level 345 ntpd off

Feb 10 2010

How to check the Disk devices attached to the Linux Server

How to check the Disk devices attached to the Linux Server

[oracle@RAC01 software]$ dmesg | grep Attached

Feb 05 2010

Linux DHCP to Static IP Address

———————Linux DHCP to Static IP Address

/etc/hosts – This is for Hostname and IP address
/etc/resolv.conf – This is for DNS
/etc/sysconfig/network – This is for Gateway change
/etc/sysconfig/network-scripts/ifcfg-eth0 – IP,Subnet and Type

1. Host Name and IP information change in /etc/hosts file
[root@RAC01 etc]# pwd
/etc
[root@RAC01 etc]# cat hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.5.80 rac01.localdomain rac01

2. Static IP address information update in Device file

[root@RAC01 network-scripts]# pwd
/etc/sysconfig/network-scripts
[root@RAC01 network-scripts]#
— Before Change
[root@RAC01 network-scripts]# cat ifcfg-eth0
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:0C:29:6C:66:60
ONBOOT=yes
DHCP_HOSTNAME=RAC01
[root@RAC01 network-scripts]#

— After Change
[root@RAC01 network-scripts]# cat ifcfg-eth0
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.5.80
NETMASK=255.255.248.0
HWADDR=00:0C:29:6C:66:60
ONBOOT=yes

3. DNS information update – Resolv.conf file – No Change required as it is in the same DNS

[root@RAC01 etc]# cat resolv.conf
; generated by /sbin/dhclient-script
nameserver 192.168.1.1
nameserver 192.168.2.1
[root@RAC01 etc]#

4. Gateway information
—Before Change
[root@RAC01 sysconfig]# pwd
/etc/sysconfig
[root@RAC01 sysconfig]# cat network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=RAC01
[root@RAC01 sysconfig]#

— After Change
[root@RAC01 sysconfig]# pwd
/etc/sysconfig
[root@RAC01 sysconfig]# cat network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=RAC01
GATEWAY=192.168.0.3
[root@RAC01 sysconfig]#

Feb 05 2010

Change the IP address in Linux Machine

You have to change the following files.

/etc/hosts – This is for Hostname and IP address
/etc/resolv.conf – This is for DNS
/etc/sysconfig/network – This is for Gateway change
/etc/sysconfig/network-scripts/ifcfg-eth0 – IP,Subnet and Type

/etc/hosts
/etc/nodenames
/etc/hostname.[device]
/etc/defaultrouter
/etc/defaultdomain
/etc/nodename

Dec 21 2009

Hardware device information in Linux

Basically manufacturer of the Card and Serial Number and Name or identifier of the Device.
You can get the card details [and all other hardware details] with ‘lspci -vvv’ command. But this may not show the serial number. You may have to check the card physically, to get the serial number.

Nov 23 2009

Convert from ext3 to ext4

Convert from ext3 to ext4

WARNING! Once you run following commands, the filesystem will no longer be mountable using the ext3. Please note that ext4 may have some bugs so do not use for production servers (wait for sometime watch Linux kernel mailing list for ext4 bugs). It’s recommended that you keep /boot in a ext3 partition for sometime.
You need ext4 patch applied into kernel and compile kernel with ext4 support. Once done type the following command to convert an existing ext3 filesystem to use ext4, type:

# tune2fs -O extents,uninit_bg,dir_index /dev/dev-name
For example convert /dev/sdb1 to ext4, enter:

# cd /; umount /dev/sdb1
# tune2fs -O extents,uninit_bg,dir_index /dev/sdb1
Next run fsck, enter:

# fsck -pf /dev/sdb1
How do I mount ext4 partition?
mount -t ext4 /dev/sdb1 /path
mount -t ext4 /dev/sdb1 /share
mount -t ext4 /dev/disk/by-uuid/YOUR-PARTITION-UUID /share

Nov 23 2009

ext4 Linux File System

ext4 Linux File System
The ext4 filesystem has more features and generally better performance than ext3, which is showing its age in the Linux filesystem world.
Features include:
Delayed allocation & mballoc allocator for better on-disk allocation
* Sub-second timestamps
* Space preallocation
* Journal checksumming
* Large (>2T) file support
* Large (>16T) filesystem support
* Defragmentation support

Oct 11 2009

UUENCODE – Email attachment

UUENCODE:

- to email attachments

- example

file_str=/export/home/oracle/dba/log/temp/.txt
new_str=/export/home/oracle/dba/log/temp/.xls
uuencode ${file_str} ${new_str} | mailx -s “

Alibi3col theme by Themocracy