Archive for the ‘redhat’ Tag

Is Linux using DHCP?

Friday, March 9th, 2018

I have been working on other things which are not Linux related so obvious things have reached the area of “oh….the answer is……”

A question was raised about a Linux virtual machine using DHCP. I remembered it wasn’t but I blanked on where to look for the answer.

Simply look in the file: /etc/sysconfig/network-scripts/ifcfg-eth0

Look for:

BOOTPROTO=dhcp
ONBOOT=yes

That shows DHCP is in use.

 

Advertisement

Restarting the automounter on Redhat

Saturday, June 20th, 2015

I had a messed up automounter and wanted to restart it. Sometimes I just draw a blank for the command. It could be that I am focused mainly on Windows these days and I simply forget the command. Who knows?

It’s simple really,

service autofs restart

If I needed to start it:

service autofs start

To get a simple status:

service autofs status

Now that I have written this; it should remain.

Correcting a bad superblock on Redhat

Saturday, April 4th, 2015

One system had an issue with the secondary drive. The monitoring system reported it was in a Read-Only state. Suspecting a bad superblock as they happen from time to time; I gave the system a reboot.

As expected; I received:

 *** An error occurred during the file system check.
 *** Dropping you to a shell; the system will reboot.
 *** When you leave the shell.
 Give root password for maintenance
 (or type Control-D)
 (repair file system)#
After entering the root password; it was time to repair. In my case, the problem was easy as the second drive is allocated to one mount. If you are not sure, you will have to look at the partitions.
To list out the partitions, simply enter:
fdisk -l

In my situation, I was interested in this part:

Disk /dev/cciss/c0d1: 146.7 GB, 146778685440 bytes
255 heads, 63 sectors/track, 17844 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

           Device Boot      Start         End      Blocks   Id  System
/dev/cciss/c0d1p1   *           1       17844   143331898+  83  Linux

If you have multiple partitions, you can verify the label as a precaution (that is if it’s still intact) by using the e2label command. For example:

e2label /dev/cciss/c0d1p1

Having verified the partition, it’s time to restore the superblock by using backup. This is accomplished by using the mke2fs command. Note: if the OS is running, you will need to unmount the drive.

Example:

mke2fs -n /dev/cciss/c0d1p1

It will list output (I forgot to copy it), but at the bottom you will see:

Superblock backups stored on blocks:
(various numbers)

It doesn’t matter which one you choose; I picked the third one. To start the restore of the superblock; enter:

e2fsck -y -b <block number> /dev/your drive path

The “-y” option is a good idea if your partition is large. Otherwise, you will find yourself pressing the “y” key many many times.

Once it’s completed, reboot the system.

Don’t be surprised if it doesn’t solve it on the first pass. Simply re-list the backup superblocks and use a different one for the e2fsck command. In my situation, it took three attempts.

Much as I would like to impress you with my knowledge, I have to give people their acknowledgments for reviewing their blog and site for review.

Linux Expresso

Linux Forums

What model is my linux server?

Wednesday, January 28th, 2015

I had a request to identify the model of a server running Redhat. There is the asset database but I wanted a faster solution.

A quick Google search and I found the answer.

Log into the server and SU to root.

# dmidecode | grep -A3 '^System Information'

System Information
 Manufacturer: HP
 Product Name: ProLiant DL360 G7
 Version: Not Specified

Check speed and duplex of an Ethernet card with Redhat

Friday, February 22nd, 2013

How does one check the speed and duplex on a computer running Redhat?

A simple tool (if installed) called ethtool will give such information.

You will have to use a root to get this information.

# ethtool eth0
Settings for eth0:
Supported ports: [ TP ]
Supported link modes:   10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes:  10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: g
Wake-on: g
Link detected: yes

ethtool can also make changes but I have not had a need to do that yet.