Skip to main content

Posts

Showing posts with the label automation

Scripting Partition Creation In Linux

I knew I could use fdisk in Linux to create partitions for me from a script. This can come in handy during kickstart for (re)deployment of a server and you don't want to let anaconda handle partitions for you. Or you simply want to be absolutely sure things go as you want, instead of relying on software with unknown bugs or quirks. I knew you can use something like: fdisk /dev/sda to partition /dev/sda for you with one large partitions and give it type 8e (LVM). (The 'q' is so that those who simply copy this, don't immediately wipe some disk.) But I was looking for somewhat cleaner, more intuitive style. James Stephens pointed out the use of sfdisk from scripts . While I don't know if sfdisk is less reliable than fdisk or parted, or how to handle byte-aligning disks [ 1 ] [ 2 ] [ 3 ] from these scripts, it's a good place to start and I wanted to document it here.

Common auto mounts for Linux and Solaris

We are trying to create some common ground between Solaris and Linux environments. For example, auto mounting scripts of NFS file systems. One issue was that Sun uses the master map file called auto_master whereas Linux defaults to auto.master . Thankfully, you can tweak /etc/sysconfig/autofs and use MASTER_MAP_NAME to tell Linux to also use auto_master . Problem solved! Update: dont' forget to open /etc/nsswitch.conf and edit the line for autofs . I had to delete nisplus .

cobbler - more Linux deployment from yum

Cobbler is a Linux installation server that allows for rapid setup of network installation environments. With a simple series of commands, network installs can be configured for PXE, reinstallations, media-based net-installs, and virtualized installs (supporting Xen, qemu, KVM, and VMware Server). Cobbler uses a helper program called 'koan' (which interacts with Cobbler) for reinstallation and virtualization support. Cobbler can also optionally help with managing DHCP, DNS, and yum package mirroring infrastructure -- in this regard, it is a more generalized "provisioning" server, rather than just dealing specifically with installations. It has a command line interface, a web interface, and also several API access options. That sounds like a lot, but it's really pretty simple.

Which DIMM is in which slot?

How do you tell which memory DIMM is in which slot without shutting down your (Linux) server nor opening the case? You maybe able to use dmidecode, haven't tried that yet. But you can also use a great little tool by Dag Wieers called lshw ... Gotta love open source... :) It's available here .

Restoring server images

While backups are usually often considered when designing high-availability server parks, doing an actual restore is often overlooked. You simply don't want to pull a plug and rather wait for the actual disaster to happen. Having a full file system image of a server, while space and time consuming can be the fastest way to get a server back online after a failure. If you have a SAN available, it can clone LUNs for your transparently and you can swap them back in when a machine fails or burn down. However, not everyone has one. Using clonezilla , you can easily pull images off of Linux or even Windows servers and restore them (even using multicast!) in minutes. As it only copies used blocks, that 300 GB local disk can result in a 5 GB image. For a restore, Clonezilla restores the appropriate image based on MAC address.

Subversion or CVS, Bazaar or Mercurial?

I've recently had to think about a good technical solution to our Source Code Management (SCM) problems. We're using a central RCS directory tree to handle everything. It started out with just a few scripts and kickstart files we needed to put under revision control , but soon it ballooned (or course)... While I do have some experience with CVS, I heard about Subversion (SVN) and other SCM tools and stumbled upon this comparison of Subversion or CVS, Bazaar or Mercurial . Great read! It doesn't offer a easy solution though, and experience is still the best guide. The difference between open and closed distributed revision control is also a tough decision to make, without solid team experience with either.

Enable Linux Login Logout Scripts

Sometimes you need a logout script to do some housekeeping, such as clean up after processes or users... Some Linux shells have means for this, such as /bin/csh. Bash shell has a .bash_logout. But you may need something stronger. Blogger Digest showed a neat trick to Enable Linux Login Logout Scripts to use a specific script of your choice. Great! Thanks!

Nagios 3.0 and Splunk

I was just playing a test set-up for Nagios , to monitor some hosts, services and devices for me across the data center, when I ran into Splunk in a config file. Being naturally curious, I checked out Splunk... Splunk is basically your IT search repository. It has a search engine that collects everything you want to track from all your servers. Use Splunk to collect SNMP traps, mail queues, log from web servers, firewall or routers, transaction and database logs and more. It can index anything because it uses live tracking. What it doesn't know but occurs frequently, you can teach it. Best of all, use Splunk to trigger an SNMP alert for a host or service in Nagios, when say more than 10 HTTP 404 errors occur on your corporate website. Probably there has been an error that some other system may or not have tried to inform you about... Excellent! Some assembly required of course, as everyone has different logs, needs, wishes and demands...

mrepo configuration

Found a good site that explains the mrepo configuration on setting up an apt/yum repository from ISO images, online updates, patches and custom packages... Looks to be very cool and much more flexible than Oracle's own ULN local mirror function...

mrepo: yum/apt repository mirroring

Just thought I'd mention this as this is the first time I ran into this... On Oracle Linux, just as on Fedora, CentOS and Red Hat, you usually install software using either up2date (blah) or yum (much better). However, setting up a local mirror for network installs or local updates, is somewhat daunting. Especially when used to the comfortable ease of Debian-based distos as they have all sources available for free on the net. Therefore it nice to know that some dedicated fellows like Dag Wieers use their time to make life a little easier for you. With tools like mrepo: yum/apt repository mirroring (formerly known as 'yam'). I haven't played with this yet, but I'm gonna look into it for sure!

Oracle Linux has issues with LVM in anaconda

We've been having a variety of problems with our LVM system partitioning and anaconda. Mind you, once it is configured and installed, the system runs fine. But during rollout, LVM has been a head breaker... Main issue is: dirty disks. Since we are booting from SAN, we have no control over the LUNs we get. Although we specify zerombr and clearpart --all in anaconda, LVM complains if there is anything on the disk. Especially if there are non-Linux partitions left on the disks. Altiris does it's boot "magic" using a DOS partition to create a known environment from which it launches stuff. This gave the anaconda installer headaches. Our work-around: don't do partitioning from anaconda, but use the pre-install phase (%pre). We force a clear of the local disk (sda) and our boot LUN (sdb) and clear partitions explicitly as well as remove any traces of LVM signatures. We remove all Logical Volumes (LV), Volume Groups (VG) and Physical Volumes (PV). While this is a lo...

anaconda failing to install Linux over dual paths

During network installs of Linux, we have 2 HBA connected to the SAN. Each provides one or more LUNs for the OS and data, as we boot from SAN. However, we have had a lot of problems with the visibility of these LUNs to the (anaconda) installer of Oracle Enterprise Linux (OEL) 4 update 5 (4U5). The current version gets confused by disks being visible twice and can't distinguish between them. So it overwrites over the second path what it already did over the first. Our current work-around was to either shutdown the FC port of one of the HBA cards on the FC switch. Another is to hide LUNs on the second HBA during install and reactivate them afterwards. However, both these cause extra manual work and unnecessarily increase complexity of the whole setup. Another solution that we're testing is to only hide the boot LUN on the second HBA, not the whole set of LUNs. Anaconda (wiki) seems to have an issue writing to disks that are visible over more than path, no reading from them. App...

Vintela: integrating Linux and Windows user, account and policy management

Just to be fair, I've been looking for ways to integrate user, account and policy management between Linux and Windows. I have a corporate Active Directory they want me to adhere to/with. So using AD as the main system, because they know how to maintain it and procedures are in place, I'd couple Oracle Linux's user accounts and groups with AD. Vintela also claims to do this, just like Centrify and Unix Components of Windows Server 2003 R2. But personally, I'm still charmed by PADL's NIS/LDAP gateway. I like using NIS to provide seamless account and access rights management with some other system that uses LDAP. That way I could potentially choose to work with MS AD, Novell NDS or a home built openLDAP authentication back-end.

Linux Interoperability in Windows Server 2003 R2

My investigation of Linux/Windows integration for user authentication also showed that Windows Server 2003 R2 has UNIX Interoperability Components , also for Linux but Microsoft tends to put them all onto one pile i.e. non-Microsoft. The UNIX Components claim to be able to give a Kerberos trust between Linux and Windows servers, probably through winbind. It has Active Directory (AD) schema updates for NIS and Kerberos authentication and lets NIS slaves sync with the AD. Using Identity Management for UNIX (IDMU), you also get a Windows-based NIS server... hmmm, I can't help but read "milage may vary" between the lines... We'll see.

Unattended Linux network install

Finally got the scripted network install working as expected. Here is how... Dell BIOS is at 1.3.7 Qlogic BIOS is at 1.24, BIOS enabled, boot LUN assigned. I disabled the 2nd HBA so the server only has one path to the SAN. Mount the Oracle Linux CD1 through Dell's DRAC interface and (re)boot the machine. Typ " linux ks=http://10.1.1.1/oel/ks.cfg ksdevice=eth0 " to start the installation and load your script. Your kickstart script should be located in the root of your installation sources, i.e. where you stored the contents of all the CDs. The last parameters is needed in case your server has multiple NICs, like ours, and avoid being asked which network card you want to use for installation. Since DHCP is enabled on that subnet, that's all that is needed. Now there is one more tricky part... upon loading the kickstart script, before the installation can start, you MUST disconnect the CD image that is still mounted in DRAC. If not, you get an endless loop and installati...

Kickstart Options

When using kickstart and a network install to do unattended installations of Oracle Linux, you mahttp://www.blogger.com/img/gl.link.gify need to reference the Kickstart Options . In my case, when trying to provision Linux servers that boot from SAN, the kickstart file that is automatically created for you after a manual install ( /root/anaconda-ks.cfg ), did not contain all the options I had given it. Specifically, your boot device must come first in the drive order. Here, sda is the local disk from the Dell PERC controller, sdb is the first LUN on the SAN. The bootloader option must therefore get the right parameter --driveorder=sdb,sda .

Starting a Kickstart Installation

If you do an installation of a Linux server over the network (called a "network install"), you'll save yourself a lot of time: you don't need to change CDs. You can also automate installation with a so-called "scripted install" using a kickstart file. This will get you an "unattended installation". A sample file anaconda-ks.cfg is saved in /root at the end of every manual install. You can use that as a starting point to create your own. When doing a network installation of Linux, you can tell Linux to use the kickstart file using a range of options . Please check the Red Hat docs for your favorite options. How do you do a network installation when booting from a CD (or PXE server)? Simple! Insert CD 1, or mount that image through DRAC or iLO, at boot the machine. At the first command line of the boot CD type: linux ks=http://server/path/kickstart_file.cfg url=http://server/path For instance, linux ks=ftp://myserver/default-ks.cfg url=ftp://myserv...