martedì 26 novembre 2013

Red Hat: How to check and repair your root-filesystem in rescue mode

Problem resolution:

Take a Linux installation media of your distribution and boot into linux rescue mode by typing the following command when asked for boot options:
linux rescue



Select your language and keyboard layout:






Network configuration is not necessary and can be skipped:





A very important step is to SKIP the mount of your Linux installation. Do not use MOUNT or READ-ONLY. For a filesystem check it is required that the filesystem is unmounted. Once mounted it is nearly unpossible to unmount your root-filesystem in rescue mode.





If you are not using a Logical Volume Manager for your filesystems you can directly jump to execute the “fsck” command. Otherwise you will have to first scan for your Physical Volumes and review them:
lvm pvscan
lvm pvdisplay




If your Physical Volumes were listed correctly continue to review the detected Volume Groups:
lvm vgdisplay

Now continue to activate your Volume Groups in order to create your Logical Volume devices in the “/dev” filesystem. In this example a Volume Group with the name “VolGroup00″ has to be activated:
lvm vgchange -a y VolGroup00




After activating your Volume Group(s), you will be able to perform a filesystem check and correct problems:
fsck /dev/VolGroup00/LogVol00




Once the filesystem check finishes successfully, you should be able to reboot without any further complication.


giovedì 14 novembre 2013

Redhat CentOS partition management (LVM)

 15  echo "- - -" >/sys/class/scsi_host/host0/scan
Questo comando forza un rescan del controller SCSI
This command forces the system to rescan the SCSI controller.

   16  fdisk -l
   17  fdisk /dev/sdb
Ho creato una partizione primaria di tipo 8e (LVM)

Created a primary partition type 8e (LVM partition)

   19  man fdisk
   20  fdisk -u /dev/sdb
   21  fdisk -l
   22  pvcreate /dev/sdb1
 Questo comando collega il disco al sistema LVM
This command is adding the phisical volume to the volume group

   23  vgs
Volume Group Show

   24  pvadd
   25  vgextend
   26  vgextend --help
   27  vgs
   28  vgextend smosvg /dev/sdb1

Aggiunto nuovo disco al Volume Group

Added the new partiton created to the volume group I want to expand

   29  vgs
   30  lvextend
   31  lvextend --help
   32  lvs
Logical Volume show

   33  lvextend -l +100%FREE /dev/mapper/smosvg-optvol

QUesto comando allarga il volume "optvol" con tutto lo spazio libero nel Volume Group

This command will expand the "optvol" with all the available space (+100%) in the volume group
   34  lvs
   35  resize2fs /dev/mapper/smosvg-optvol
Rircostruisce il file system con le nuove dimensioni
Rebuilds the file system with the new dimentions

   36  df -h

lunedì 11 novembre 2013

RedHat CentOS setting Date and Time

Date and Time Setup
The date command allows the superuser to set the system date and time manually:
Change the current date. Type the command in the following form at a shell prompt, replacing the YYYY with a four-digit year, MM with a two-digit month, and DD with a two-digit day of the month:

~]# date +%D -s YYYY-MM-DD

For example, to set the date to 2 June 2010, type:
~]# date +%D -s 2010-06-02

Change the current time. Use the following command, where HH stands for an hour, MM is a minute, and SS is a second, all typed in a two-digit form:

~]# date +%T -s HH:MM:SS

If your system clock is set to use UTC (Coordinated Universal Time), add the following option:
~]# date +%T -s HH:MM:SS -u
For instance, to set the system clock to 11:26 PM using the UTC, type:
~]# date +%T -s 23:26:00 -u

Change TimeZone Using /etc/localtime File

For this example, assume that your current timezone is UTC as shown below. You would like to change this to Pacific Time.
# date
Mon Sep 17 22:59:24 UTC 2010
On some distributions (for example, CentOS), the timezone is controlled by /etc/localtime file.
Delete the current localtime file under /etc/ directory
# cd /etc
# rm localtime
All US timezones are located under under the /usr/share/zoneinfo/US directory as shown below.
# ls /usr/share/zoneinfo/US/
Alaska          Arizona         Eastern         Hawaii          Michigan        Pacific
Aleutian        Central         East-Indiana    Indiana-Starke  Mountain        Samoa
Note: For other country timezones, browse the /usr/share/zoneinfo directory
Link the Pacific file from the above US directory to the /etc/localtime directory as shown below.
# cd /etc
# ln -s /usr/share/zoneinfo/US/Pacific localtime
Now the timezone on your Linux system is changed to US Pacific time as shown below.
# date
Mon Sep 17 23:10:14 PDT 2010

Redhat CentOS disable iptables Firewall

How Do I Disable Firewall?

First login as the root user.






Check if firewall is running



#service iptables status

Next enter the following three commands to disable firewall.

# service iptables save
# service iptables stop
# chkconfig iptables off


If you are using IPv6 firewall, enter:

# service ip6tables save
# service ip6tables stop
# chkconfig ip6tables off

Redhat CentOS mount USB key

TO MOUNT A USB KEY
insert key
dmesg to see the device name that can be any sb-b-c-d depending on your system.

mount /dev/sdb1 /

Remember the "1" after sdb

RedHat CentOS mounting virtual-phisical cdrom-dvdrom

When you plug the external USB drive in you should see messages like these from 'dmesg'

usb 1-2.3: USB disconnect, address 8
usb 1-2.3: new high speed USB device using ehci_hcd and address 9
scsi6 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 9
usb-storage: waiting for device to settle before scanning
Vendor: LITE-ON Model: DVDRW SHW-1635S Rev: YS0J?
Type: CD-ROM ANSI SCSI revision: 00
sr0: scsi3-mmc drive: 48x/48x writer cd/rw xa/form2 cdda tray
Attached scsi CD-ROM sr0 at scsi6, channel 0, id 0, lun 0
usb-storage: device scan complete

If you don't see the 'Vendor' stuff there's nothing that can be done. Your drive/enclusure combination do not work together. This isn't a Linux issue but a Firmware/BIOS issue between the drive and enclosure. Try another drive/enclosure combination, or give up.

If you seen the 'Vendor' stuff and the message regarding 'Attached scsi CD-ROM sr0' then you may be in luck! Linux recognised the drive and has attached it.

Put a CDROM or DVDROM in the drive and attempt to mount it.

    mount -t iso9660 -o ro /dev/sr0 /mnt

(you may have another device name. I have seen /dev/scd0)

No returned errors will mean that you have successfully mounted the CDROM under /mnt.

Any error about missing block device will mean that you need to install and load some kernel modules.

RedHat Centos Network configuration (CLI)

Set Default gateway:
insert in /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=
GATEWAY=

##############################################################################
Backup existing static configuration

First backup existing network configuration file using cp command:
# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /root/ifcfg-eth0.bak

Configuring a DHCP Client

Setting up a Linux for dhcp can be done by editing file using a text editor such as vi:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0

Following is sample static configuration:
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:19:D1:2A:BA:A8
IPADDR=10.10.10.10
NETMASK=255.255.255.0
ONBOOT=yes

Replace static configuration with DHCP:
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:19:D1:2A:BA:A8
ONBOOT=yes

Save and close the file. Just restart network service:
# /etc/init.d/network restart

Please note that you need a configuration file for each device that you want to configure to use DHCP.Backup existing static configuration

First backup existing network configuration file using cp command:
# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /root/ifcfg-eth0.bak


Save and close the file. Just restart network service:
# /etc/init.d/network restart

Please note that you need a configuration file for each device that you want to configure to use DHCP.

lunedì 10 giugno 2013

Amd Fusion E-350 epia boards Ubuntu Drivers.


http://en.wikipedia.org/wiki/AMD_Catalyst#Linux

Type in the following.





  1. sudo apt-get update
  2. sudo apt-get install fglrx-updates

worked fine for me. Solved slow machine wile file copy. smb slow transfer.

lunedì 18 marzo 2013

VMWARE Powering on a virtual machine from the command line

ESXi 5.0

To power on a virtual machine from the command line:
  1. List the inventory ID of the virtual machine with the command:

    vim-cmd vmsvc/getallvms |grep
    Note: The first column of the output shows the vmid.

  2. Check the power state of the virtual machine with the command:

    vim-cmd vmsvc/power.getstate
  3. Power-on the virtual machine with the command:
    vim-cmd vmsvc/power.on

ESXi 4.1

To power on a virtual machine from the command line:
  1. List the inventory ID of the virtual machine with the command:

    vim-cmd vmsvc/getallvms |grep

    Note: The first column of the output shows the vmid.
  2. Check the power state of the virtual machine with the command:

    vim-cmd vmsvc/power.getstate
  3. Power-on the virtual machine with the command:

    vim-cmd vmsvc/power.on

ESXi 4.0

To power on a virtual machine from the command line:
  1. List the inventory ID of the virtual machine with the command:

    vmware-vim-cmd vmsvc/getallvms |grep
    Note: The first column of the output shows the vmid.
  2. Check the power state of the virtual machine with the command:

    vmware-vim-cmd vmsvc/power.getstate
  3. Power on the virtual machine with the command:

    vmware-vim-cmd vmsvc/power.on

ESX 4.0 and ESX 4.1

To power on a virtual machine from the command line:
  1. To list the path of all the virtual machines on the host:

    vmware-cmd -l
  2. Get the state of the virtual machine with the command:

    vmware-cmd getstate
  3. Power on the virtual machine with the command:

    vmware-cmd start

ESXi 3.5

To power on a virtual machine from the command line:
  1. List the inventory ID of the virtual machine with the command:

    vim-cmd vmsvc/getallvms |grep
  2. Check the power state of the virtual machine with the command:

    vim-cmd vmsvc/power.getstate
  3. Power on the virtual machine with the command:

    vim-cmd vmsvc/power.on

ESX 3.5

To power on a virtual machine from the command line:
  1. To list the path of all the virtual machines on the host:

    vmware-cmd -l
  2. Get the state of the virtual machine with the command:

    vmware-cmd getstate
  3. Power on the virtual machine with the command:

    vmware-cmd start

giovedì 21 febbraio 2013

RedHat Use CDROM as repository

Try the following To install using yum / DVD:

Mount Redhat 5 DVD on your server/workstation. 

Create a new file xxx.repo in /etc/yum.repos.d/ with the following contents to update directly from the RPMs on the disk:

[dvdmedia]
name=Red Hat 5 DVD
baseurl=file:///path/to/mounted/DVD/rpms/
enabled=1


yum groupinstall "GNOME Desktop Environment"

After the installation either remove the created file from /etc/yum.repod.d  or disable it with "enabled=0"

Let me know if this worked for you.


For future use I recommend you to get the license for RHEL (for updates), or installing Fedora Core which is in all ways same product without the paid(license)  support from Red Hat.

in case you get a problem with public key:

In case someone hit this thread like I did:

The provider of your .rpm signed it with its private key to proove it is a genuine file from them.
We can verify it with the public key (but not sign, see wikipedia RSA PKI about public/private keys FYI)

Practically that means you need to find the public key and import it
in my case it was a file named: RPM-GPG-KEY ( from Red HAt distro)

suggestion: find / -name "*GPG*" 

then import the public key with: rpm --import *GPG*
and it should be ok.


In my case:
Public key for openoffice.org-libs-1.1.5-10.6.0.2.EL4.i386.rpm is not installed
[root@taz isoCDs]# rpm --import /mounted_RHEL4.6-i386-ES-disc4/RPM-GPG-KEY
[root@taz isoCDs]# yum install openoffice.org.i386

giovedì 14 febbraio 2013

Configure the Router to Cisco ios 12.0 Automatically Boot from an Image in Flash Memory


Router# configure terminal
Router(config)# boot system flash gsnew-image
Router(config)# config-register 0x010F
Router(config)# end
Router# copy system:running-config nvram:startup-config
[ok]
Router# reload
[confirm]

%SYS-5-RELOAD: Reload requested
System Bootstrap, Version 4.6(0.16), BETA SOFTWARE
Copyright (c) 1986-1995 by cisco Systems
RP1 processor with 16384 Kbytes of memory
F3: 1871404+45476+167028 at 0x1000