Showing posts with label quickly. Show all posts
Showing posts with label quickly. Show all posts

Tuesday, May 3, 2011

Quickly - persistent modules loading on RHEL

The kernel modules required for booting the system up are part of an initial  ramdisk which is automatically loaded into the memory by a boot loader. The ramdisk contains enough modules to mount the root filesystem and to initialize essential devices like keyboard, console or   various expansion cards.  The boot process  then continues with running the init process.

During the next phase, the other modules referenced by the operating system  are loaded automatically.  The modules are called by their aliases specified and set in the /etc/modprobe.conf configuration file. The typical alias is e.g. eth0 for a network interface card or usb-controller for an USB controller.

If we need  to load some specific module during the system boot and there isn't a way to reference it we have a few choices how to do it.
  • Place a particular modprobe command to the /etc/rc.d/rc.local script which is called at the end of the whole boot process. But it is likely to be late at this phase.
  • Or better, place the command in the  /etc/rc.modules file which is read and executed by the /etc/rc.d/rc.sysinit initialization script during the system initialization phase. It may be better to load the modules as soon as possible.
The /etc/rc.modules does not exist by default, so at first create it and make it executable. I think the first method is commonly used by many of us but the second one is in my opinion more systematical.

Tuesday, March 24, 2009

Quickly - SLES 10 reactivation

If you need to assign an already registered SLES 10 system to a new or different subscription the quickest way how to do it is to use suse_register command from console:
suse_register -i -f
The -f switch forces registration and -i runs registration interactively. The registration form will be available via lynx text web browser. Prepare your activation code and finish the registration.

Wednesday, December 3, 2008

Quickly - Linux Swap space sizing

It's no surprise that many system administrators are still using this simple rule of thumb for sizing their system's swap size:
  • the swap space should be as large as twice amount of system operating memory
I belonged to them. But is it still really necessary to follow that rule when our machines are equipped with gigabytes of RAM now? Sure, it is waste of disk space. If I have a machine with 32 GB RAM, the swap space should have at least 64 GB!

This rule of thumb really held in the past but nowadays the Linux kernel and its memory management are more mature and well optimized to be able to work without any swap space. Even, if you use a swap file instead of dedicated swap partition, it should have nearly the same performance as swapping to partition. So, do we have a newer replacement for it? In genereal, it is recommended to remember the following:
  • if the machine has less then 2 GB of RAM, the swap space should have the size of it
  • if it has more, the swap space should have 2GB
In my opinion, you can't screw anything up if you set the swap space to 2 GB everytime. It has to be enough for every common situation according to the above rules. In more special scenarios, like database or web servers, it is better to follow related tuning guides.


Thursday, November 6, 2008

VCB, vcbMounter, vcbRestore ...

I have written a series of articles about VMware VCB usage. They are concerned about main VCB principles. The backup procedures are performed via VCB command line utilities. It's not bad idea to make a quick list of articles for better orientation among them:
  1. VM identification - how to identify a virtual machine you intend to backup? The command vcbvmname is the answer.
  2. VM full backup - how to perform a full backup of the chosen virtual machine? The vcbmounter command can do it.
  3. VM full backup data access - how to retrieve data from the virtual machine's full backup? It is possible to mount the backup image with the mountvm command.
  4. VM file level backup - the vcbmounter command is able to perform file-level backup as well.
  5. VM backup over NFS - this article describes a simple scenario of virtual machine backup over NFS protocol.
  6. VM backup restore - finally, it is important to know the process of restoring a virtual machine from the backup. You can use vcbrestore.
I hope this quick list of articles will help you to find what you are looking for. Your prompts are welcome.

Wednesday, August 20, 2008

Quickly - how to download a file to the ESX 3.x service console?

The VMware ESX 3.x is missing wget package so you can't use wget command to download anything from the Internet as you wish. In spite of wget, the service console provides lwp-* tools which are simple perl scripts based on LWP and URI perl modules and which allow to do some basic tasks around the HTTP protocol.

The tools are part of perl-libwww-perl package. The package is installed by default. The most important tool is lwp-download which you can use for downloading files. Let's check the steps how to download something:
  1. esxcfg-firewall --allowOutgoing
    • allow outgoing connections from service console
  2. lwp-download http://dfn.dl..../apcupsd-3.14.4-1.el3.i386.rpm
    • download apcupsd package
  3. esxcfg-firewall --blockOutgoing
    • return firewall to the initial state
Beside this, the perl-libwww-perl package contains other tools like lwp-mirror, lwp-request and lwp-rget. Check their man pages for their usage.

Thursday, August 14, 2008

Quickly - how to determine the ESX host version?

In my opinion, the easiest way how to find out the ESX host version, is to log in to the service console and use the esxupdate command. The major version can be found in the file /etc/vmware-release. For example, it may contain:
VMware ESX Server 3
So, the major version is 3.x. To determine minor version is a little complicated. Run this command from service console:
esxupdate query
And try to identify patches with the following prefixes from the end of command output (the last one is the right one):
  1. ESX - the minor version should be 0, so we have version 3.0.x
  2. ESX350 - the minor version is 5, the version is 3.5.0
  3. 3.5.0 - initial instalation of version 3.5.0
The corresponding lines may look like these:
3.5.0-64607    16:25:29 05/27/08 ESX 3.0.x to 3.5.0-64607 upgrade
3.5.0-64607 10:42:31 08/06/08 Full bundle of ESX 3.5.0-64607
It remains to identify the update level. Use the same command as above and check the full patch name now:
  1. ESX350-Update01 - we have 3.5.0 Update 1
  2. ESX350-Update02 - we have 3.5.0 Update 2
The corresponding lines are:
ESX350-Update01    16:59:56 05/27/08 ESX Server 3.5.0 Update 1
ESX350-Update02 10:42:38 08/06/08 ESX Server 3.5.0 Update 2
Do you know another way how to reach the version? Beside this, I have found this knowledge base article.

Tuesday, July 22, 2008

Quickly - /dev/vcs and /dev/tty magic on Linux

Have you ever wanted to check the content of the first virtual console without switching to it with "Ctrl+Alt+F1" shortcut from your desktop session? Or the second console of a remote server? Or would you like to send something to the user who is working at the third virtual console (not via wall command)?

The GNU/Linux kernel provides two character devices for such tasks:
  • /dev/ttyX - represents X. virtual console
  • /dev/vcsX - represents X. virtual console text contents
So, to answer the questions use these commands:
  1. cat /dev/vcs1
  2. ssh root@server 'cat /dev/vcs2'
  3. echo "something" > /dev/tty3
More information about Linux allocated devices is written in /usr/src/linux/Documentation/devices.txt. You have to have GNU/Linux sources installed.

Tuesday, July 15, 2008

Quickly - RPM uninstall and scriptlet failure

Sometimes it happens that I'm not able to uninstall a RPM package because of some internal SPEC file errors related to the scriptlets. Last time it happened when I was uninstalling the HP OpenView Storage Data Protector packages from a RHEL server. By mistake, I uninstalled one package which was a dependency of another package and after that I wasn't able to uninstall it due to that dependency and due to it wasn't checked correctly. The whole uninstall procedure looked like this:
  1. rpm -e OB2-CORE-A.06.00-1
  2. rpm -e OB2-DA-A.06.00-1
And the produced error follows:
  • ERROR: Cannot find /opt/omni//bin/omnicc
  • error: %preun(OB2-DA-A.06.00-1.x86_64) scriptlet failed, exit status 3
So, is there a way how to get rid of such a package? Yes, it is and it is simple, just disable executing the scriptlets like this:
  1. rpm -e --noscripts OB2-DA-A.06.00-1
I think it is pretty simple feature of RPM but it is a bit difficult to remember it.

Wednesday, June 11, 2008

Quickly - XEN hypervisor and full virtualization

An interesting article about XEN hypervisor and support of full virtualization (or HVM) was published in the last Red Hat Magazine release. It summarizes three useful commands how to find if your system supports it (run these commands from dom0):
  • is your Intel CPU utilizing VT-x extension?
    • grep -i vmx /proc/cpuinfo
  • is your AMD CPU utilizing Secure Virtual machine (or SVM) extension?
    • grep -i svm /proc/cpuinfo
  • finally, is your XEN hypervisor capable of HVM?
    • grep -i hvm /sys/hypervisor/properties/capabilities
The previous commands aren't RHEL specific only. They have to work on any XEN installation. By the way, the /sys/hypervisor/ directory contains many other useful information. If you would like to find out which processors support HVM take a look at XEN wiki pages.

Friday, March 28, 2008

Quickly - Raw devices summary

Yesterday, I posted an article about configuration of raw devices on RHEL 5 platform. Just for completeness, I would like to add a few words about what raw devices on Linux are useful for.

A raw device allows to do raw I/O operations with an underlying block device. The raw I/O operation means that it bypasses kernel's block buffer cache so the I/O operation is sent directly to the underlying device. The raw I/O operation or better the application issuing it has to be aware of physical layout of the device. That means it has to be aligned in memory and on disk as well. The operation has to begin at the specified sector offset and has to have the size of multiple sectors. The restriction holds for both memory and disk.

The feature is useful for application requiring direct access to device like DBMS which are doing data caching by themselves.

Monday, February 25, 2008

Quickly - PCI Express

Do you know how PCI Express work? Do you know how PCI Express slots look like or how do you figure how fast is a slot? I was looking for some picture or scheme of PCI Express slots and related speeds. Nothing more, just to be aware of it. I have found the following picture. More about it is written at computer.howstuffworks.com. Another comprehensive source of information is wikipedia.org.

Tuesday, January 29, 2008

Quickly - configuring VLANs on Linux

This post is similar to the one about configuring VLANs on RHEL but is applicable on any Linux distribution. VLANs support has been included into the Linux kernel since version 2.4.14. Earlier versions requires to be patched properly. More about it and patches is placed here. Again, configuration steps which requires to be done as root:
  1. we have already configured eth0 interface which is accessible from the network and we want to add VLAN support to it, e.g. to accept packets tagged with VLAN ID 123 (avoid using VLAN ID 1, it is often used as administration VLAN)
  2. we need to have support at the kernel level, try to load the proper module
    • modprobe 8021q
  3. you don't need to know how to modify configuration file's of interface eth0 because we are going to use the vconfig command to do it
  4. to turn on VLAN ID 123 on the interface eth0, use the command:
    • vconfig add eth0 123
  5. check that the previous command was applied successfully, you can use ifconfig command of course:
    • ifconfig eth0.123
  6. finally, configure the remaining settings you want to set for the interface eth0, do it with ifconfig again
  7. to make the changes persistent place the commands to some rc script or create your own init script and enable it during system boot
  8. to check the status, kernel has exported some status information here:
    • cat /proc/net/vlan/eth0.123
  9. if you want to remove the interface, try these two:
    • ifconfig eth0.123 down
    • vconfig rem eth0.123

Monday, December 17, 2007

Quickly - configuring VLANs on RHEL

  • configuration steps on RHEL (4, 5) - they have to be done as root:
    1. we have already configured eth0 interface which is accessible from the network and we want to add VLAN support to it, e.g. to accept packets tagged with VLAN ID 123 (avoid using VLAN ID 1, it is often used as administration VLAN)
    2. we need to have support at the kernel level, try to load the proper module
      • modprobe 8021q
    3. configuration of interface eth0 is stored in the following file and it may contain its MAC address, IP address, netmask, network and so on
      • /etc/sysconfig/network-scripts/ifcfg-eth0
    4. to accept packets with VLAN ID 123 on that interface, run the following commands:
      • cd /etc/sysconfig/network-scripts/
      • cp ifcfg-eth0 ifcfg-eth0.123
    5. the new configuration file defines virtual interface eth0.123 of the main interface eth0, which will accept untagged packets from VLAN 123
    6. to enable VLANs on the interface eth0, append this line to the newly created configuration file
      • VLAN=yes
    7. and change the line defining interface name from eth0 to eth0.123
      • DEVICE=eth0.123
    8. correct another settings - IP address, netmask and related
    9. finally, apply the new network settings with
      • /etc/init.d/network restart
    10. check the status via proc interface
      • /proc/net/vlan/eth0.123