18.2. RAID0 - 串連 (Striping)
前一頁 | 章 18. GEOM: 模組化磁碟轉換框架 | 下一頁

## 18.2. RAID0 - 串連 (Striping)

Written by Tom Rhodes and Murray Stokely.

串連會合併數個磁碟成單一個磁碟區 (Volume)，可以透過使用硬體 RAID 控制器來做到串連。GEOM 磁碟子系統提供了軟體支援的磁碟串連，也就是所謂的 RAID0，而不需要 RAID 磁碟控制器。

在 RAID0 中，資料會被切割成數個資料區塊 (Block) 寫入到磁碟陣列中的每一個磁碟機。如下圖所示，取代以往等候系統寫入 256k 到一個磁碟的時間， RAID0 可以同時寫入 64k 到磁碟陣列中四個磁碟的每個磁碟，這可提供優異的 I/O 效能，若使用多個磁碟控制器可增加更多的效能。

在 RAID0 串連中的每個磁碟必須要相同大小，因為 I/O 的請求是平行交錯讀取或寫入到多個磁碟的。

### 注意:

RAID0 並不提供任何備援 (Redundancy) 功能。這意謂著若磁碟陣列中的其中一個磁碟故障，所有在該磁碟上的資料便會遺失。若資料很重要，請規畫備份策略，定期儲存備份到遠端系統或裝置。

The process for creating a software, GEOM-based RAID0 on a FreeBSD system using commodity disks is as follows. Once the stripe is created, refer to gstripe(8) for more information on how to control an existing stripe.

過程 18.1. Creating a Stripe of Unformatted ATA Disks

1. Load the `geom_stripe.ko` module:

       # kldload geom_stripe

2. Ensure that a suitable mount point exists. If this volume will become a root partition, then temporarily use another mount point such as `/mnt`.

3. Determine the device names for the disks which will be striped, and create the new stripe device. For example, to stripe two unused and unpartitioned ATA disks with device names of `/dev/ad2` and `/dev/ad3`:

       # gstripe label -v st0 /dev/ad2 /dev/ad3
       Metadata value stored on /dev/ad2.
       Metadata value stored on /dev/ad3.
       Done.

4. Write a standard label, also known as a partition table, on the new volume and install the default bootstrap code:

       # bsdlabel -wB /dev/stripe/st0

5. This process should create two other devices in `/dev/stripe` in addition to `st0`. Those include `st0a` and `st0c`. At this point, a UFS file system can be created on `st0a` using `newfs`:

       # newfs -U /dev/stripe/st0a

   Many numbers will glide across the screen, and after a few seconds, the process will be complete. The volume has been created and is ready to be mounted.

6. To manually mount the created disk stripe:

       # mount /dev/stripe/st0a /mnt

7. To mount this striped file system automatically during the boot process, place the volume information in `/etc/fstab`. In this example, a permanent mount point, named `stripe`, is created:

       # mkdir /stripe
       # echo "/dev/stripe/st0a /stripe ufs rw 2 2" \
       >> /etc/fstab

8. The `geom_stripe.ko` module must also be automatically loaded during system initialization, by adding a line to `/boot/loader.conf`:

       # sysrc -f /boot/loader.conf geom_stripe_load=YES

前一頁 | 上一層 | 下一頁
章 18. GEOM: 模組化磁碟轉換框架 | 起始頁 | 18.3. RAID1 - 鏡像 (Mirroring)

本文及其他文件，可由此下載： ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/。

若有 FreeBSD 方面疑問，請先閱讀 FreeBSD 相關文件，如不能解決的話，再洽詢 <questions@FreeBSD.org>。
關於本文件的問題，請洽詢 <doc@FreeBSD.org>。