Pablo Iranzo Gómez's blog

mar 28, 2015

Install RHEL7/Centos/Fedora on a software raid device

Installing Linux on a RAID has lot of advantages, from using RAID1 to enjoy protection against drive failures or RAID0 to combine the size of several drives to create bigger space for files with all the smaller disks we have.

There are several RAID level definitions and may have different uses depending on our needs and hardware availability.

For this, I focused on using raid1 for the system disks (for greater redundancy/protection against failures) and raid0 (for combining several disks to make bigger space available for non important data)..

Why or why not use a RAID via software

Pros

  • There's no propietary data on the disks that could require this specific controller in case the hardware fails.
  • Can be performed on any system, disk combination, etc

Cons

  • The use of dedicated HW RAID cards allows to offload the CPU intensive tasks for raid calculation, etc to the dedicated processor, freeing internal CPU for system/user usage.
  • Dedicated cards may have fancier features that require no support from the operating system as are all implemented by the card itself and presented to the OS as a standard drive.

Performing the setup

As I was installing on a HP Microserver G8 recently, I had to first disable the advanced mode for the included controller, so it behaved like a standard SATA one, once done, I was able to boot from my OS image (in this case EL7 iso).

Once the ISO is booted in rescue mode, I could switch to the second console with ALT-F2 so I could start executing commands on the shell.

First step is to setup partitioning, in this case I did two partitions, first one for holding /boot and the second one for setting up the LVM physical volume where the other Logical Volumes will be defined later.

I've elected this setup over others because mdadm allows transparent support for booting (grub supports booting form it) and easy to manage setup.

For partitions, remember to allocate at least 500mb for /boot and as much as needed for your SO, for example, if only base OS is expected to have RAID protection, having a 20Gb partition will be enough, leaving the remaining disk to be used for a RAID0 device for allocating non-critical files.

For both partitions, set type with fdisk to fd: Linux RAID autodetect, and setup the two drives we'll use for initial setup using the same values, for example:

fdisk /dev/sda
n # for new partition
p # for primary
<ENTER> # for first sector
+500M # for size
t # for type
fd # for Linux RAID autodetect
n # new partition
p # primary
<ENTER>
+20G #for size
t #for type
2 # for select 2nd partition
fd # for Linux RAID autodetect
# n for new partition
p # for primary
<ENTER> # for first sector
<ENTER> # for remaining disk
t # for type
3 # for third partition
fd # for Linux RAID Autodetect
w # for Writing changes

And repeat that for /dev/sdb

At this point, we'll have both sda and sdb with the same partitions defined: sd{a,b}1 with 500Mb for /boot and sd{a,b}2 with 20Gb for LVM and the remaining disk for RAID0 LVM.

Now, it's time to create the raid device on top, for simplicity, I tend to use md0 for /boot, so let's start with it.

Creating the raid devices with Multiple Devices mdadm

Let's create the raid devices for each system, starting with /boot:

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2
mdadm --create /dev/md2 --level=0 --raid-devices=2 /dev/sda3 /dev/sdb3

Now, check the status of the raid device creation by issuing:

cat /proc/mdstat

Personalities : [raid1] [raid6] [raid5] [raid4]
md0 : active raid1 sda1[0] sdb1[1]
      534760 blocks level 1, 64k chunk, algorithm 2 [2/2] [UU]
            [==>..................]  recovery = 12.6% (37043392/292945152) finish=127.5min speed=33440K/sec
md1 : active raid1 sda2[0] sdb2[1]
      20534760 blocks level 1, 64k chunk, algorithm 2 [2/2] [UU]
            [=====>...............]  recovery = 25.9% (37043392/692945152) finish=627.5min speed=13440K/sec
...

When it finishes, all the devices will appear as synced, and we can start the installation of the operating system.

What I did, after this point, is to reboot the install media, so I could use anaconda installer to select manually the filesystems, creating /boot on /dev/md0, then the Physical Volume on /dev/md1 for the operating system.

Select the manual partitioning during the installation to define above devices as their intended usage, and once it has been installed, create the additional Physical volume on /dev/md2 and define the intended mountpoints, etc.

Enjoy!

Click to read and post comments

mar 24, 2015

Octopress for jekyll blogging

After testing for some days Jekyll and github.io for blog posting, I was missing some features of other CMS, so I started doing some search on how to automate many other topics while keeping simplicity on blog posting.

Octopress Makes this extra step so you can still focus on your contents and of course have a nice template as starting point with integrations for some social plugins, etc.

Setup is well done if you follow the provided steps, without jumping anything, in my case, I moved my old pages (plain jekyll + poole) to OctoPress.

On Fedora and as my unprivileged user, I did:

One of the interesting things it that it uses two branches on git, master and source, where master is the one that github publishes (your live environment) and source is the actual code for your blog, templates, posts, etc that are later generated, previewed and deployed from above steps.

I'll be testing it for a while to see how it works, but so far, so good.

Click to read and post comments

mar 16, 2015

Podcasts with flexget and transmission

Some podcasts are available via rss feeds, so you can get notified of new episodes, so the best way I've found so far to automate this procedure is to use the utility 'flexget'.

Flexget can download an rss feed and get the .torrent files associated to them and store locally, which makes a perfect fit for later using Transmission's watch folder, to automatically add them to your download queue.

In order to do so, install flexget either via pip (pip install flexget) or using a package for your distribution a create a configuration file similar to this:

cat ~/.flexget/config.yml

tasks:
  download-rss:
    rss: http://URL/TO/YOUR/PODCAST/FEED
    all_series: yes
    only_new: yes
    download: /media/watch/

At each invokation of flexget execute it will access the rss feed, search for new files and store the relevant .torrent files on the folder /media/watch from where transmission will pick up the new files and add them to your downloading queue for automatic download.

posted at 21:45  ·   ·  fedora
Click to read and post comments

Jekyll and MarkDown

For my work I've been using markdown for a while, it allows to use some formatting on the documents created (mainly for knowledge base and solutions) without too much hassle for the formating.

On the other side I was willing to improve the ability to make it easier to post new entries to blog without having to wait too much time, and of course, be able to prepare them offline and then push them live.

  • Using spip allowed me to focus on text without caring too much about formatting, the CMS is not hard to administer, maybe not as popular as wordpress, joomla lately, but definitely, good for the work it's intended to do, and not like traditional webpages.

  • Using blogger, formatting was also not a hard part, and being a good platform improved the availability of tools, but still required online access, and the firefox extensions for it, were still not convinging me for daily usage.

Yesterday, while I was reading some information about github, I got back to their 'hosting' solution (github.io) and like the idea of pushing the code via git (I love the offline commit and later push of all changes), and started reading about Jekyll and Poole.

Jekyll and Poole enhance the creation of webpage posts using MarkDown with some automation for automatic generation of links, reusability of common elements, etc which creates a set of static pages, fast to serve, upload, etc.

I've also used Jekyll-Import to gather my old posts at blogger and I will still convert some of them to markdown and try to get back the auto-code coloring I had inplace (using external JS library).

Well, let's see how this goes and will try to implement some template to website not to use the standard one soon.

PD: This was being written while offline at the aiport on a trip to Helsinki ;-)

posted at 09:06  ·   ·  jekyll
Click to read and post comments

oct 24, 2012

RHEV/OVIRT API with Python

RHEV/oVirt api allows faster and simple development of scripts / utilities ranging from gathering of information to VM/host, etc manipulation.

For example, a simple script for connecting to API and list VM's could be:

import sys
import getopt
import optparse
import os
import time

from ovirtsdk.api import API
from ovirtsdk.xml import params
from random import choice

baseurl = "https://localhost:8443"
api = API(url=baseurl, username="admin@internal",password="redhat",insecure=True)

for vm in api.vms.list():
    print vm.name

The .list() method works pretty well, but beware, it limits collections to 100 elements for performance reasons, so in those cases, we'll need to check how many results do we have, and paginate by passing an extra argument to our ".list()" invocation, for example:

for vm in api.vms.list(query="page 1")

Furthermore, we can check the number of results by using:

len(api.vms.list(query="page 1"))

And playing together, we could set a list that returns all results by running:

vms = []
page = 0
length = 100
while (length > 0):
    page = page + 1
    query = "%s page %s" % (oquery, page)
    tanda = api.vms.list(query=query)
    length = len(tanda)
    for vm in tanda:
        vms.append(vm)

We can also make funny things like migrate VM's to another host by just running:

vm.migrate()

It's expected for RHEV 3.1 to have a developer guide (now in Beta) at https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Virtualization/3.1-Beta/html-single/Developer_Guide/index.html

Check it for more examples of use and put the Virtualization to work for you!

posted at 13:38  ·   ·  python  rhev  ovirt
Click to read and post comments
← Previous Next → Page 3 of 13