Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1210972
  • 博文数量: 116
  • 博客积分: 2889
  • 博客等级: 少校
  • 技术积分: 1337
  • 用 户 组: 普通用户
  • 注册时间: 2007-03-29 09:35
个人简介

IT运维工程师、律师 IT相关技术支持、法律咨询

文章分类

全部博文(116)

文章存档

2015年(1)

2014年(2)

2013年(5)

2012年(12)

2011年(4)

2010年(12)

2009年(21)

2008年(37)

2007年(22)

分类: 系统运维

2012-04-26 13:44:57



软raid5构建过徎:
环境:现有146G硬盘4块,一块已经安装本地系统,后加3块做raid5.
命令过徎:
root@wxserver-ftp # format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c1t0d0
          /pci@0,0/pci10de,375@f/pci108e,286@0/disk@0,0
       1. c1t1d0
          /pci@0,0/pci10de,375@f/pci108e,286@0/disk@1,0
       2. c1t2d0
          /pci@0,0/pci10de,375@f/pci108e,286@0/disk@2,0
       3. c1t3d0
          /pci@0,0/pci10de,375@f/pci108e,286@0/disk@3,0
Specify disk (enter its number): 1
根据硬盘的ID,输入1-4,调整硬盘的参数。0为本地硬盘,只有1-3可以调整 。
输入2,并回车,再输入partition回车、输入print回车,相看当前硬盘的分区列表。
一般s6调置为最大的容量分区,s7分100mb,存储硬盘的raid信息。
(注意:先建大容量分区,再建100mb分区,并且Cylinders不能重合,应该是连续的。可以看到下面的
硬盘的最大Cylinders是17830,每块硬盘的分区列表应该相同)
如果提示错误:  (this disk may be in use by an application that has modified the fdisk table .Ensure that this disk is not currently in use before proceeding to use fdisk )
在disk命令下,执行fdisk回车,再重新分区即可。

PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        ! - execute , then return
        quit
partition> p
Current partition table (original):
Total disk cylinders available: 17830 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
  0 unassigned    wm       0                0         (0/0/0)             0
  1 unassigned    wm       0                0         (0/0/0)             0
  2 unassigned    wu       0                0         (0/0/0)             0
  3 unassigned    wm       0                0         (0/0/0)             0
  4 unassigned    wm       0                0         (0/0/0)             0
  5 unassigned    wm       0                0         (0/0/0)             0
  6 unassigned    wm       0 - 17492      134.00GB    (17493/0/0) 281025045
  7 unassigned    wm   17493 - 17505      101.98MB    (13/0/0)       208845
  8       boot    wu       0 -     0        7.84MB    (1/0/0)         16065
  9 unassigned    wm       0                0         (0/0/0)             0

在每块硬盘的分区执行完成后,输入label命令,保存已经设置好的分区。

以前步骤,硬盘分区构建完成,以下构建raid.
2.建立metadb信息(用S6 100MB空间存储raid信息)
   
metadb --查看当前的raid信息情况
metadb -a -f -c 3 c1t1d0s6 c1t2d0s6 c1t3d0s6
metadb -d -f -c 3 c1t1d0s6 c1t2d0s6 c1t3d0s6 --删除raid信息
metastat  --查看当前的raid硬盘情况,如果有删除掉。
metainit -f d10 -r c1t1d0s7 c1t2d0s7 c1t3d0s7  --注意是s7,也就是最大空量的硬盘分区
metastat --当建立好的raid5,硬盘完成同步后,进度条达到100%后,才可以创建文件系统
newfs /dev/md/dsk/d10   --在d10上创建文件系统
   vi /etc/vfstab
    /dev/md/dsk/d10 /dev/md/rdsk/d10  /raid5d10 ufs  2 yes -        --创建开机自动挂载
手动挂载命令:mkdir /raid5d10   
           mount /dev/md/dsk/d10 /raid5d10
           
至此,完成软raid5的构建。
   
------------以下是做的时候截取的一段日志,记录以备后用-----------------
root@wxserver-ftp # format 
Searching for disks...done
 
 
AVAILABLE DISK SELECTIONS:
       0. c1t0d0
          /pci@0,0/pci10de,375@f/pci108e,286@0/disk@0,0
       1. c1t1d0
          /pci@0,0/pci10de,375@f/pci108e,286@0/disk@1,0
       2. c1t2d0
          /pci@0,0/pci10de,375@f/pci108e,286@0/disk@2,0
       3. c1t3d0
          /pci@0,0/pci10de,375@f/pci108e,286@0/disk@3,0
Specify disk (enter its number): 1
selecting c1t1d0
[disk formatted]
/dev/dsk/c1t1d0s6 is part of SVM volume raid:d10. Please see metaclear(1M).
/dev/dsk/c1t1d0s7 contains an SVM mdb. Please see metadb(1M).
 
 
FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        fdisk      - run the fdisk program
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !     - execute , then return
        quit
format> p
 
 
PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        ! - execute , then return
        quit
partition> p
Current partition table (original):
Total disk cylinders available: 17830 + 2 (reserved cylinders)
 
Part      Tag    Flag     Cylinders         Size            Blocks
  0 unassigned    wm       0                0         (0/0/0)             0
  1 unassigned    wm       0                0         (0/0/0)             0
  2 unassigned    wu       0                0         (0/0/0)             0
  3 unassigned    wm       0                0         (0/0/0)             0
  4 unassigned    wm       0                0         (0/0/0)             0
  5 unassigned    wm       0                0         (0/0/0)             0
  6 unassigned    wm       0 - 17492      134.00GB    (17493/0/0) 281025045
  7 unassigned    wm   17493 - 17505      101.98MB    (13/0/0)       208845
  8       boot    wu       0 -     0        7.84MB    (1/0/0)         16065
  9 unassigned    wm       0                0         (0/0/0)             0
 
partition> exit
`exit' is not expected.
partition> quit    
 
 
FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        fdisk      - run the fdisk program
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !     - execute , then return
        quit
format> quit
root@wxserver-ftp # metadb 
        flags           first blk       block count
     a m  pc luo        16              8192            /dev/dsk/c1t1d0s7
     a    pc luo        8208            8192            /dev/dsk/c1t1d0s7
     a    pc luo        16400           8192            /dev/dsk/c1t1d0s7
     a    pc luo        16              8192            /dev/dsk/c1t2d0s7
     a    pc luo        8208            8192            /dev/dsk/c1t2d0s7
     a    pc luo        16400           8192            /dev/dsk/c1t2d0s7
     a    pc luo        16              8192            /dev/dsk/c1t3d0s7
     a    pc luo        8208            8192            /dev/dsk/c1t3d0s7
     a    pc luo        16400           8192            /dev/dsk/c1t3d0s7
root@wxserver-ftp # metainit 
usage:  metainit [-s setname] [-n] [-f] concat/stripe numstripes
                width component... [-i interlace]
                [width component... [-i interlace]] [-h hotspare_pool]
        metainit [-s setname] [-n] [-f] mirror -m submirror...
                [read_options] [write_options] [pass_num]
        metainit [-s setname] [-n] [-f] RAID -r component...
                [-i interlace] [-h hotspare_pool]
                [-k] [-o original_column_count]
        metainit [-s setname] [-n] [-f] hotspare_pool [hotspare...]
        metainit [-s setname] [-n] [-f] softpart -p [-A alignment]
                [-e] device size|all
        metainit [-s setname] [-n] [-f] md.tab_entry
        metainit [-s setname] [-n] [-f] -a
        metainit -r
root@wxserver-ftp # metainit -r
root@wxserver-ftp # metastat 
d10: RAID
    State: Okay         
    Interlace: 32 blocks
    Size: 562001895 blocks (267 GB)
Original device:
    Size: 562017280 blocks (267 GB)
        Device     Start Block  Dbase        State Reloc  Hot Spare
        c1t1d0s6      16395        No         Okay   Yes 
        c1t2d0s6      16395        No         Okay   Yes 
        c1t3d0s6      16395        No         Okay   Yes 
 
Device Relocation Information:
Device   Reloc  Device ID
c1t1d0   Yes    id1,sd@TSun_____STK_RAID_INT____0A326EB1
c1t2d0   Yes    id1,sd@TSun_____STK_RAID_INT____823E6EB1
c1t3d0   Yes    id1,sd@TSun_____STK_RAID_INT____99466EB1
阅读(2031) | 评论(2) | 转发(0) |
给主人留下些什么吧!~~

victorchang2012-04-27 10:24:39

虾米小: 很好的文章啊,这样的文章可以多发发.....
水平有限,尽量!

虾米小2012-04-26 18:32:42

很好的文章啊,这样的文章可以多发发