FreeBSD 研习课程讲义
Prev 使用FreeBSD的软体RAID(ccd) Next

【前言】

FreeBSD中的Concatenated disk (ccd)是一种软体式RAID ,能让你拥有Strip、Mirror,甚至Parity 等RAID card 才有的功能,这样能将原有的小磁碟分区联合起来,形成一个大的档案系统。

【安装及设定】

1. 先把硬碟 fdisk

 

2. 在 kernel 中加入对ccd的支援 之后重新编译


指令:pseudo-device ccd 4

NOTE:pseudo-device ccd number
连结磁碟(Concatenated disks)。这个虚拟装置允许你连结数个磁碟机的分割区成一个大磁碟。number 表示最多会建立几个连结磁碟(不是所有可以被连结的磁碟机个数)。叁阅 ccd(4) 与 ccdconfig(8) 以获得更多资讯。


NOTE:In FreeBSD 5.0, it is not necessary to specify(指定) a number of ccd devices, as the ccd device driver is now cloning(复制) -- new device instances will automatically be created on demand(要求).

 

3. 对硬碟作disklabel


指令:

disklabel -r -w ad0 auto
disklabel -r -w ad1 auto


NOTE:-r
disk represents(表示) the raw(未加工的) disk in question, and may be in the form da0 or /dev/da0c. It will display all of the parameters(叁数) associated(关联的) with the drive and its partition layout(规划).

下一步是改变disklable的类型。

指令:

disklabel -e ad1
disklabel -e ad2
disklabel -e ad3

接着把以下资讯做修改
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
c: 60074784 0 unused 0 0 0 # (Cyl. 0 - 59597)
e: 60074784 0 4.2BSD 2048 16384 89 # (Cyl. 0 - 59597)

改为


8 partitions:
# size offset fstype [fsize bsize bps/cpg]
c: 60074784 0 unused 0 0 0 # (Cyl. 0 - 59597)
e: 60074784 0 4.2BSD 0 0 0 # (Cyl. 0 - 59597
)

NOTE:fstype 一定要是 4.2BSD

4. 建立档案系统
ccd0c 的设备节点可能不存在,所以要建立它。

指令:

cd /dev
sh MAKEDEV ccd0

NOTE:在 FreeBSD 5.0, devfs(5) 将自动管理在 /dev, 的设备结点,所以没有必要使用 MAKEDEV 命令。


5. 设定 ccd※以下步骤请用单人模式进入系统内设定※

指令:

ccdconfig ccd0 32 2 /dev/ad0 /dev/ad1

为何要设定 32 2,请叁考王波的ccd磁碟设备

6. newfs档案系统

指令:

newfs /dev/ccd0c

若出现这个错误讯息
newfs: ioctl (WDINFO): No such process
newfs: /dev/ccd0c: can't rewrite disk label

请叁阅以下指令:

# disklabel ccd0 > /tmp/disklabel.tmp
# disklabel -Rr ccd0 /tmp/disklabel.tmp
# disklabel -e ccd0

因为ccd 实际上是一个『虚拟』的装置,它不是实际上的磁碟。所以用这些方法来解决这个问题。

7. 自动创建
最后,要挂上 ccd(4) ,需要先配置它。把当前的配置档写入 /etc/ccd.conf 中。

指令:

ccdconfig -g > /etc/ccd.conf

当重新启动系统时,如果 /etc/ccd.conf存在, /etc/rc 就运行ccdconfig -C。这样就能自动配置 ccd(4) 。

NOTE: /etc/fstab 中配置一个记录,以便在启动时它能被挂上。 如下所示:

/dev/ccd0c              /挂载点       ufs     rw      2       2


记得使用mkdir任意建立一个和挂载点相同名称的目录,好让ccd0能mount上来。

8.重新启动系统  
  用df -h检查ccd0c是否被mount上来了
       


Prev Home Next
Proxy Server 分流档(proxy.pac) UP 使用Rsync作主机资料的备份