ページ更新: 2003-12-14 (日) (6249日前)
[編集]raid1 カーネルモジュールを入れる ## modconf /kernel/drivers/md Multiple disks (RAID).を選んで、 lqqqqqqqqqqqqqqqu Select kernel/drivers/md modules tqqqqqqqqqqqqqqqk x The modules that are currently installed on your system have x x a "+" character to the right of their name. Modules that aren't x x installed have a "-" to the right of their name. You can read a x x page about the purpose of any module and then you can enable x x or disable it. To do so, use the up and down arrow keys to move x x the cursor to the line for the module, and then press ENTER. x x x x Exit Finished. Return to previous menu. x x x x linear - Linear (append) mode x x lvm-mod + Logical Volume Manager (LVM) support x x md + Multiple devices driver support x x multipath - Multipath I/O support x x raid0 - RAID-0 (striping) mode x x raid1 - RAID-1 (mirroring) mode x x raid5 - RAID-4/RAID-5 mode x x xor - RAID-4/RAID-5 mode x x x x x x <Ok> <Cancel> x x x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj # lsmod Module Size Used by Not tainted raid1 11876 0 (unused) md 43296 0 (autoclean) [raid1] lvm-mod 44288 8 (autoclean) : (略)[編集] raidtoolを入れる #パッケージを検索して、 # apt-cache search ^raid webmin-raid - raid control module for webmin raidtools - Utilities to support 'old-style' RAID disks raidtools2 - Utilities to support 'new-style' RAID disks 説明を読んで、 # apt-cache show raidtools2 Package: raidtools2 Priority: optional Section: admin Installed-Size: 464 Maintainer: Pekka Aleksi Knuutila <pa@debian.org> Architecture: i386 Version: 0.90.20010914-15 Replaces: mdutils Provides: mdutils Depends: libc6 (>= 2.2.4-4), libpopt0 (>= 1.6.2-1), debconf, makedev (>= 2.3.1-24) Conflicts: raidtools, mdutils, file-rc (<<0.4.3) Filename: pool/main/r/raidtools2/raidtools2_0.90.20010914-15_i386.deb Size: 128208 MD5sum: 5cd9b087e9e8125383e5d64aae3a513b Description: Utilities to support 'new-style' RAID disks The Multiple Device driver's main goal is to group several disks or partitions together, making them look like a single block device. This includes linear adding of disks, RAID-0, -1, -4 and -5. . 'New-style' RAID arrays have a lot features not present in the 'older' RAID arrays, including autodetection. Old arrays can be upgraded with this package, and it is mostly a good idea to use this package when creating new RAID arrays. . In order to use this package, you must have a kernel with 'new-style' RAID drivers, which are included in stock kernels since the 2.4 series. For older kernels, you can find patches at http://people.redhat.com/mingo/raid-patches/. で、入れる。 # apt-get install raidtools2 Reading Package Lists... Done Building Dependency Tree... Done The following packages will be REMOVED: raidtools The following NEW packages will be installed: raidtools2 0 packages upgraded, 1 newly installed, 1 to remove and 3 not upgraded. Need to get 128kB of archives. After unpacking 213kB will be used. Do you want to continue? [Y/n] Get:1 http://ftp.jp.debian.org woody/main raidtools2 0.90.20010914-15 [128kB] Fetched 128kB in 0s (228kB/s) Preconfiguring packages ... (Reading database ... 40402 files and directories currently installed.) Removing raidtools ... Selecting previously deselected package raidtools2. (Reading database ... 40377 files and directories currently installed.) Unpacking raidtools2 (from .../raidtools2_0.90.20010914-15_i386.deb) ... Setting up raidtools2 (0.90.20010914-15) ...[編集] 付属文書を見て... ## cd /usr/share/doc/raidtools2 # ls README Software-RAID.HOWTO/ copyright README.Debian changelog.Debian.gz examples/ # ls examples/ multipath.conf.sample raid1.conf.sample raid5.conf.sample raid0.conf.sample raid4.conf.sample raidtab.sample で、raidtools2のファイルも確認。 # dpkg --listfiles raidtools2 /. /sbin /sbin/raidstart /sbin/mkraid /sbin/mkpv /etc/ /etc/raid/ : /etc/raid/ ってなんだろ。 [編集]RAID1構成の作成 #/dev/hda1, /dev/hda4をRAIDで使う。cfdiskでtype=0xfdに変えておく。 Linuxを再起動。(不要かも……調べるべき) # cp /usr/share/doc/raidtools2/examples/raid1.conf.sample /etc/raidtab # vi /etc/raidtab # cat raidtab raiddev /dev/md0 raid-level 1 nr-raid-disks 2 nr-spare-disks 0 chunk-size 4 device /dev/hda1 raid-disk 0 device /dev/hda4 raid-disk 1 # mkraid /dev/md0 handling MD device /dev/md0 analyzing super-block disk 0: /dev/hda1, 499936kB, raid superblock at 499840kB disk 1: /dev/hda4, 499968kB, raid superblock at 499904kB # cat /proc/mdstat Personalities : [raid1] read_ahead 1024 sectors md0 : active raid1 ide/host0/bus0/target0/lun0/part4[1] ide/host0/bus0/target0/lun0/part1[0] 499840 blocks [2/2] [UU] unused devices: <none>[編集] RAID1 (/dev/md0) の中にパーティションを作ってみる。 ## cfdisk /dev/md0 (ごそごそ) # fdisk -l /dev/md0 Disk /dev/md0: 2 heads, 4 sectors, 124960 cylinders Units = cylinders of 8 * 512 bytes Device Boot Start End Blocks Id System /dev/md0p1 1 15625 62498 83 Linux こんなことできるのね。だったら、LVMのPVも作れるはず…。 [編集]RAID1 (/dev/md0) をLVMで使う #早速試してみる。 # pvcreate /dev/md0 pvcreate -- physical volume "/dev/md0" successfully created # vgcreate vgmd0 /dev/md0 vgcreate -- INFO: using default physical extent size 4 MB vgcreate -- INFO: maximum logical volume size is 255.99 Gigabyte vgcreate -- doing automatic backup of volume group "vgmd0" vgcreate -- volume group "vgmd0" successfully created and activated # lvcreate -n home -L 100M /dev/vgmd0 lvcreate -- doing automatic backup of "vgmd0" lvcreate -- logical volume "/dev/vgmd0/home" successfully created # mke2fs -j /dev/vgmd0/home mke2fs 1.27 (8-Mar-2002) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 25688 inodes, 102400 blocks 5120 blocks (5.00%) reserved for the super user First data block=1 13 block groups 8192 blocks per group, 8192 fragments per group 1976 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729 Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 24 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. # mount /dev/vgmd0/home /mnt # df Filesystem Size Used Avail Use% Mounted on /dev/hda3 35G 8.4G 24G 26% / /dev/vgmd0/home 97M 4.1M 87M 5% /mnt お、ちゃんとPVもVGもLVもできて、マウントできた。 # cp -a /etc/* /mnt/etc/ |