Bienvenido! - Willkommen! - Welcome!

Bitácora Técnica de Tux&Cía., Santa Cruz de la Sierra, BO
Bitácora Central: Tux&Cía.
Bitácora de Información Avanzada: Tux&Cía.-Información
May the source be with you!

Friday, October 1, 2010

GParted and RAID

RAID stands for Redundant Array of Inexpensive Disks. This is a solution where several physical hard disks (two or more) are governed by a unit called RAID controller, which turns them into a single, cohesive data storage block.
An example of a RAID configuration would be to take two hard disks, each 80GB in size, and RAID them into a single unit 160GB in size. Another example of RAID would be to take these two disks and write data to each, creating two identical copies of everything.
RAID controllers can be implemented in hardware, which makes the RAID completely transparent to the operating systems running on top of these disks, or it can be implemented in software, which is the case we are interested in.
There are quite a few RAID schemes, known by numbers and names, such as RAID 0, RAID 1, RAID 5, and others. You may also have heard of RAID striping and mirroring, which are names for RAID 0 and RAID 1, respectively.
If you're interested, Wikipedia has a very nice article on the subject.
RAID is interesting, because we can no longer use physical disks and partitions as units of measure. Instead, we have a higher level of hierarchy instead, defining how the devices should be called. If you remember this important fact when setting up RAID, it will be much easier for you to understand the concept.
RAID devices in Linux are denoted by letters md followed by a single letter. For instance, md0, md1, md6, these are valid examples for RAID devices. There is no strict relation whatsoever between md devices and physical hard disks and their partitions.
For example, md0 could be a RAID 0 device, spanning physical sda1 and sdb1 partitions. It could also be a RAID 1 device, spanning physical sda1 and sdb2 partitions. In both cases, the device name would remain the same, while the physical topography underneath would be different.
Here's an example:
We can see that GParted does not display RAID (md) devices, but it does identify them. The RAID partitions are marked with the raid flag (more about those later).
One thing worth noting is that on sda6, GParted is unable to recognize the filesystem. This is because the RAID configured on that partition is such that sda6 does not provide all the information on the filesystem used, preventing GParted from properly classifying the partition. We're using RAID 0, known as striping on sda6 (and sdb6), which converts these two partitions into a single device. Therefore, each partition contains only half the information, hence deciding on what data is contained cannot be deducted from just looking at a single partition in the pair.
This should not bother you, as it's perfectly all right. However, you should remember that this can happen - and know what it means. We will talk about this in great detail in a dedicated tutorial.
Another example, this time using the command-line utility fdisk, here's what a RAID layout might look like:
Notice the Linux raid autodetect filesystem. This means that partitions sda1 and sdb1might be used in a RAID configuration. What and how exactly, we will focus on that in a separate article.
Another useful command for checking the status/presence of RAID devices on the system is the /proc/mdstat command:
For example, on the system above, we have three RAID devices, md0-2, each containing a pair of devices in a Mirror configuration, also known as RAID 1. Again, do not get flustered if you find this short sub-section too technical. A separate tutorial will explain RAID in detail.
While GParted can identify RAID devices, it cannot create or fail them. To this end, you will have to use other utilities. For now, though, it is important that you understand what RAID is what it looks like, so you can properly identify the layout and change it accordingly if needed.

Advanced tasks
This section is not strictly related to GParted. It's more of a bonus appendix, showing you a number of useful tricks that can enhance your partitioning skills. Here, though, we will have to leave the GUI behind and work with command line tools.
Change the Inode size
Inodes are data structure units that regulate how the filesystem will treat directories and files residing on it. A filesystem with small inodes will be able to house a very large number of files, but it won't have the best read/write performance. A filesystem will large inodes will be more suited for I/O throughput, but it won't be able to store too many files on it. Whatever the need, changing inodes cannot be done through the GParted GUI.
Why should you care?
That's a good question. Why would anyone be interested in changing the defaults set by the filesystem. Well, it turns out that some imaging software, like Acronis True Image, can only work with Linux filesystems that use inodes of the 128-byte size. However, some modern distributions, like Ubuntu 8.10 Intrepid Ibex, use 256-byte inodes, thus making the software unusable with this Ubuntu release.
This has caused quite a stir among the Acronis True Image users who happen to dual boot Windows and Linux and like to use their product to create system backups of both their operating systems.
The solution to the problem is very simple.
First, we need to check what our filesystem currently uses. This is done using the tune2fssystem utility.
(sudo) tune2fs -l /dev/ | grep "Inode size"
The above command polls the filesystems on the relevant /dev/ device for information. The grep command merely extracts the specific bit we need.
Let's see what we get on our Ext3 filesystem formatted by GParted (our sdb5 from earlier):
We have the Inode size: 256. Not good. We won't be able to use Acronis. So we need to change the size. This can be done using the mke2fs formatting utility for Ext2-based filesystems.
(sudo) mke2fs -j -I 128 /dev/sdb5
This will format the sd5 device as Ext3 filesystem (-j flag) with Inode size 128 (-I flag).
Indeed, if we check again:
Our Inode size is good now. In general, I recommend all dual-boot users, especially those fond of imaging, to perform these steps manually on all partitions they intend to use for Linux and image from Windows and/or using a Windows-based program like Acronis.
That's about it.
We now know the ins and outs of partitioning and working with GParted. Congratulations!
Now, for some extras ...

No comments: