如何在Linux中配置RAID(4)

现在这儿是一个快速例子:

What do we have here?

我们这儿做了什么?

--create tells mdadm to create a new RAID device.

--create告诉mdadm创建新的RAID设备。

--verbose tells it to print information about its operations.

--verbose告诉mdadm打印它运行的信息。

/dev/md0 is the new RAID device that we want to create.

/dev/md0是我们想要创建的新的RAID设备。

--level=raid1 defines the RAID level; in our case, RAID 1 (Mirror).

--level=raid1定义了RAID 的级别;我们的例子中,RAID1(镜像)。

--raid-devices=2 specifies how many disks (devices) are going to be used in the creation of the new RAID device.

--raid-devices=2 指定创建新的RAID设备会用到多少磁盘(设备)。

/dev/sda1 /dev/sdb1 are the two disks that are going to be used in the creation.

/dev/sda1 /dev/sdb1将会在新的创建中使用到的两个磁盘。

Simple, right?

很简单,对吗?

OK, now that we know what RAID is and how it works, let's configure one - or two!

好了,现在我们知道什么是RAID,以及它是如何工作的。开始配置1或2!

Working with RAID - real-life examples

使用RAID工作- 真实的例子

In this section we will install a complete Linux operating system from scratch, with RAID 0 and RAID 1 used on the partitions on two local hard disks. We will also tackle the questions on how these devices are created and grouped, how the system identifies and uses them, and how the GRUB bootloader fits into the picture.

在本节中,我们将从头安装一个完整的Linux操作系统,使用本地硬盘上的分区的RAID0和RAID1。我们还会解决这些设备是如何被创建和结合的,系统是如何识别和使用它们,GRUB引导是如何适合图片。

I will demonstrate the configuration of RAID using Ubuntu 8.10 Intrepid Ibex as the test platform. As mentioned earlier, Ubuntu 8.10 is no longer the most current release - and this does not matter one bit. The general idea remains the same - and this is what I want you to learn: the principle. Once you grasp the fundamental concepts of RAID setup, you will be able to this on any which operating system.

我会演示使用Ubuntu8.10 Intrepid Ibex做为测试平台配置RAID。早前提到,Ubuntu8.10不再是最新的版本——这不要紧。总的想法是一样的——这就是我想要你学得:原理。一段你掌握了RAID设置的基本概念,你将能够在任何操作系统上配置。

Furthermore, configuring RAID on Ubuntu is a good choice for several more reasons:

此外,在Ubuntu上配置RAID从几个原因上都是不错的选择:

Ubuntu is the most popular Linux desktop distro, which probably means there's a fair chance you will indeed be setting up RAID on Ubuntu or one of its flavors.

Ubuntu是最流行的Linux桌面发行版,这可能意味着有一个公平机会,你的确会在Ubuntu上配置RAID或者它的特征之一。

The default Ubuntu installation is very simple; so simple, in fact, that is strips away some of the features for the sake of simplicity. One of the victims is indeed RAID, which cannot be configured using the standard installation from the live CD. You need the Alternate CD, which uses a text-driven installation menu and allows you to setup RAID, as well as other advanced options. The text installers looks "old" - meaning you will not really feel like you're installing Ubuntu. This will help you understand the concept beyond colors and pretty menus, allowing you to transition to other distributions with ease.

默认的Ubuntu的安装非常简单;如此简单,事实上,为了简单起见,除去了一些功能。其中受损害的是RAID,不能从CD上标准安装配置。你需要另外的CD,使用文本驱动的安装菜单,允许你像其他高级选择一样安装RAID。文本安装看起来“旧”——意味着你不会真觉得你在安装Ubuntu。这帮助你理解颜色和漂亮菜单之外的概念,允许你轻松地过渡到其他发行版。

The use of an older release and the Alternate CD allows me to prove a point: that no matter which distribution you choose, the power of Linux can be unleashed to the fullest. You do not have to disqualify distros on the premises of being "too simple" or "dumbed down" simply because such propositions are untrue.

旧版本的使用和备用CD允许我证明一个观点:无论你选择哪个发行版,Linux的能力被释放到最充分。你不必在“过于简单”或“简单化”的前提取消发行版,因为这样的前提是不存在的。

All right, now that you know what we're up to, let's begin.

好吧,现在你知道我们准备做什么了,我们开始吧。

Installing Ubuntu via Alternate CD is similar to almost every Linux installation you have seen or tried or read about. Place the CD into the CD tray, boot, follow instructions.

通过备用CD安装Ubuntu几乎类似于你见过或尝试或阅读的每一种Linux安装。把CD放入CD托盘,引导,按照指导操作。

Partitioning

分区

After a while, you will reach the Partition Disks stage. This is where the fun begins. We will choose the manual method.

过一会儿,到了磁盘分区阶段。这是有趣的地方。我们选择手动方式。

You will see the existing setup, if any. In our case, we have two hard disks, roughly identical, each with three partitions on it. Each disk holds a primary ext3 partition and a 500MB swap and a ~2GB ext3 partition inside the Extended volume.

你会看到现有的设置,如果有的花。就我们而言,我们有两块硬盘,大致相同,每个磁盘上有3个分区。每块磁盘有主要的ext3分区和500MB的交换区和扩展卷中的2GB的ext3分区。

This means we have quite a bit of freedom when it comes to creating RAID arrays, where the logic beckons to pair sda1 with sdb1, sda5 with sdb5 and so forth.

这意味着到创建RAID阵列时我们有相当多的自由,其中逻辑搭配有sda1和sdb1,sda5和sdb5等等。

Edit partitions

编辑分区

To do that, we need to change the partitions. Highlight any and hit Enter. The installer will graciously tell you that You are editing ... This partition is formatted with ..., so there are no mistakes.

为了做到这一点,我们需要改变分区。突出显示任何一个并按下回车键。安装程序会很有风度地告诉你,你正在编辑。。。这个分区的格式为。。。,所以没有错误。

We need to change the Use as: field.

我们需要改变使用:字段。

Change type to RAID

改变类型为RAID

We will change the type to: physical volume for RAID.

我们会改变类型为:RAID的逻辑卷。

We will repeat this for all our partitions. The final layout should be something like this:

我们会对所有分区重复这步。最后的设置应该是像这样:

Once you do this, a new category will show up in the menu. At the beginning you only had Guided partitioning and Help on partitioning. Take a look above if you don't remember. Now, there's a new one: Configure software RAID.

一旦你这样做,一个新的类别会出现在菜单。最初分区上只有引导分区和帮助。如果你记不住仔细看看上面。现在,有个新的:配置软件RAID。

The installer now recognizes the partitions flagged as RAID volumes and can now configure them.

安装程序现在识别标记为RAID逻辑卷的分区,现在可以配置它们。

Configure software RAID

配置软件RAID

The first thing, you will receive a warning. It tells you the changes you have just made will be committed. Furthermore, no additional changes will be allowed. Make sure you are satisfied with your layout before proceeding.

第一件事,你会收到警告。它告诉你你刚刚做得更改将会被执行。此外,没有其他更改将被允许。确保在进行前你对你的设置满意。

What is going to happen is that the RAID superblock is going to be written on the devices, marking them with a higher order hierarchy than just physical partitions. This will allow the operating system as well as RAID utilities to properly handle these devices.

下一步是RAID超级块将会被写到设备上,使用比仅仅物理分区更高层级的标记。这允许操作系统以及RAID工具妥善处理这些设备。

After that, the next step is to create a new MD device. By the way, earlier, we mentioned the mdadm utility. One of its mode is the ability to create MD devices. In fact, this is exactly what is happening underneath the hood. Later, we'll see the text command that do the same job as the installer above.

此后,下一步是创建新的MD设备。顺便说一下,刚才我们提到mdadm工具。其中的一种模式能够创建MD设备。事实上,这正是在下一步骤。稍后,我们会看到文本命令做上述同样的工作。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wywzpd.html