LINUX Raid 磁盘创建 (笔记)

 
[root@test ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
 
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
 
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-130, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130): 100M
…….. 一直建三个区
Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): fd
Changed system type of partition 3 to fd (Linux raid autodetect)
…….... 一直做 4
Command (m for help): w
The partition table has been altered!
 
[root@test ~]# mdadm -C /dev/md0 -l 5 -n 3 -x 1 /dev/sdb[1-4]
[root@test ~]# mdadm /dev/md0
/dev/md0: 15.50MiB raid5 3 devices, 1 spare. Use mdadm --detail for more detail.
[root@test ~]# mke2fs -j /dev/md0
[root@test ~]# mdadm --detail /dev/md0
/dev/md0:
        Version : 00.90.03
  Creation Time : Tue Apr  7 15:54:37 2009
     Raid Level : raid5
     Array Size : 15872 (15.50 MiB 16.25 MB)
    Device Size : 7936 (7.75 MiB 8.13 MB)
   Raid Devices : 3
  Total Devices : 4
Preferred Minor : 0
    Persistence : Superblock is persistent
 
    Update Time : Tue Apr  7 19:34:42 2009
          State : clean
 Active Devices : 3
Working Devices : 4
 Failed Devices : 0
  Spare Devices : 1
         Layout : left-symmetric
     Chunk Size : 64K
           UUID : f927fef6: 2c 876cf8:1ff11ab6:ce26e 2a 6
         Events : 0.2
    Number   Major   Minor   RaidDevice State
       0       8       17        0      active sync   /dev/sdb1
       1       8       18        1      active sync   /dev/sdb2
       2       8       19        2      active sync   /dev/sdb3
       3       8       20        -      spare   /dev/sdb4 (热备盘)
 
 [root@test mnt]# mkdir raid5
[root@test mnt]# mount /dev/md0 /mnt/raid5
或者
[root@test raid5]# vi /etc/fstab
/dev/md0      /mnt/raid5         ext3    defaults        0 0

你可能感兴趣的:(linux,职场,raid,休闲)