Chinaunix首页 | 论坛 | 博客
  • 博客访问: 38210
  • 博文数量: 7
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 113
  • 用 户 组: 普通用户
  • 注册时间: 2013-12-10 17:29
个人简介

asdfasdfasdfasdf

文章分类

全部博文(7)

文章存档

2014年(6)

2013年(1)

我的朋友

分类: 服务器与存储

2014-06-13 15:44:17

1.创建4个硬盘
[root@pc10 ~]# fdisk -l

Disk /dev/vda: 42.9 GB, 42949672960 bytes
16 heads, 63 sectors/track, 83220 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005784f

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *           3        1018      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/vda2            1018       83221    41430016   8e  Linux LVM
Partition 2 does not end on cylinder boundary.

Disk /dev/vdb: 8589 MB, 8589934592 bytes
16 heads, 63 sectors/track, 16644 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/vdc: 8589 MB, 8589934592 bytes
16 heads, 63 sectors/track, 16644 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/vdd: 8589 MB, 8589934592 bytes
16 heads, 63 sectors/track, 16644 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/vde: 8589 MB, 8589934592 bytes
16 heads, 63 sectors/track, 16644 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg_pc6-lv_root: 38.2 GB, 38193332224 bytes
255 heads, 63 sectors/track, 4643 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg_pc6-lv_swap: 4227 MB, 4227858432 bytes
255 heads, 63 sectors/track, 514 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

2。建立raid5卷
[root@pc10 ~]# mdadm --create /dev/md0 --level=5 --raid-devices=4 /dev/vdb /dev/vdc /dev/vdd /dev/vde
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.

3.格式化文件系统
[root@pc10 ~]# mkfs.ext4 /dev/md0
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=128 blocks, Stripe width=384 blocks
1572864 inodes, 6288000 blocks
314400 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
192 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
4096000

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: 
done

This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

4.把raid5卷加入启动
[root@pc10 ~]# mdadm --detail --scan >> /etc/mdadm.conf
[root@pc10 ~]# cat /etc/mdadm.conf 
ARRAY /dev/md0 metadata=1.2 spares=1 name=pc10:0 UUID=32dfa223:db563b62:8dfbc340:6b7d528d

5.查看raid5信息
[root@pc10 ~]# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4] 
md0 : active raid5 vde[4] vdd[2] vdc[1] vdb[0]
      25152000 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/3] [UUU_]
      [===========>.........]  recovery = 59.0% (4955264/8384000) finish=2.9min speed=19396K/sec
      
unused devices:

[root@pc10 raid5]# mdadm --detail /dev/md0
/dev/md0:
        Version : 1.2
  Creation Time : Fri Jun 13 03:29:55 2014
     Raid Level : raid5
     Array Size : 25152000 (23.99 GiB 25.76 GB)
  Used Dev Size : 8384000 (8.00 GiB 8.59 GB)
   Raid Devices : 4
  Total Devices : 4
    Persistence : Superblock is persistent


    Update Time : Fri Jun 13 03:40:13 2014
          State : clean 
 Active Devices : 4
Working Devices : 4
 Failed Devices : 0
  Spare Devices : 0


         Layout : left-symmetric
     Chunk Size : 512K


           Name : pc10:0  (local to host pc10)
           UUID : 32dfa223:db563b62:8dfbc340:6b7d528d
         Events : 22


    Number   Major   Minor   RaidDevice State
       0     252       16        0      active sync   /dev/vdb
       1     252       32        1      active sync   /dev/vdc
       2     252       48        2      active sync   /dev/vdd
       4     252       64        3      active sync   /dev/vde


6.挂载raid5分区
[root@pc10 ~]# mkdir /mnt/raid5
[root@pc10 ~]# mount /dev/md0 /mnt/raid5
[root@pc10 ~]# ll /mnt/raid5/
total 16
drwx------. 2 root root 16384 Jun 13 03:31 lost+found

7.没有做spare
[root@pc10 raid5]# df -h
Filesystem                  Size  Used Avail Use% Mounted on
/dev/mapper/vg_pc6-lv_root   36G  2.2G   32G   7% /
tmpfs                       1.9G     0  1.9G   0% /dev/shm
/dev/vda1                   485M   32M  428M   7% /boot
/dev/md0                     24G  172M   23G   1% /mnt/raid5


8.vim /etc/fstab 加入启动项
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/md0                /mnt/raid5              ext4    defaults        0 0







阅读(1415) | 评论(0) | 转发(0) |
0

上一篇:openstack 使用实验

下一篇:lvm 学习

给主人留下些什么吧!~~