milujite 发表于 2011-11-24 15:12

solaris 10用SVM创建各种卷例子

本帖最后由 milujite 于 2011-11-24 15:15 编辑

其实官方中文文档都有的~最近看卷的帖子比较多,自己刚好前几天做了下实验,分析给大家吧。实验
有两个磁盘c2t0d0和c3t0d0。两个盘的s0都分配20mb大小,用于存放2个metadb,并且分区表如下:
Part      Tag    Flag   Cylinders      Size            Blocks
0 unassigned    wm       0 -    9       20.00MB    (10/0/0)      40960
1 unassigned    wm      10 - 1033      2.00GB    (1024/0/0)4194304
2   backup    wu       0 - 4091      7.99GB    (4092/0/0) 16760832
3 unassigned    wm    1034 - 2057      2.00GB    (1024/0/0)4194304
4 unassigned    wm    2058 - 3081      2.00GB    (1024/0/0)4194304
5 unassigned    wm    3082 - 4091      1.97GB    (1010/0/0)4136960
6 unassigned    wm       0               0         (0/0/0)         0
7 unassigned    wm       0               0         (0/0/0)         0
8       boot    wu       0 -    0      2.00MB    (1/0/0)      4096
9 unassigned    wm       0               0         (0/0/0)         0

metadb状态:
#metadb -a -c 2 -f c2t0d0s0 c3t0d0s0
#metadb -i
      flags         first blk       block count
   a      u         16            8192            /dev/dsk/c2t0d0s0
   a      u         8208            8192            /dev/dsk/c2t0d0s0
   a      u         16            8192            /dev/dsk/c3t0d0s0
   a      u         8208            8192            /dev/dsk/c3t0d0s0
r - replica does not have device relocation information
o - replica active prior to last mddb configuration change
u - replica is up to date
l - locator for this replica was read successfully
c - replica's location was in /etc/lvm/mddb.cf
p - replica's location was patched in kernel
m - replica is master, this is replica selected as input
W - replica has device write errors
a - replica is active, commits are occurring to this replica
M - replica had problem with master blocks
D - replica had problem with data blocks
F - replica had format problems
S - replica is too small to hold current data base
R - replica had device read errors

创建raid0条带卷(即创建一个条带,串联里有两个组件):
#metainit d0 1 2 c2t0d0s1 c3t0d0s1 -i 16k
#metaclearc2t0d0s1 c3t0d0s1
#metastat -p
d0 1 2 c2t0d0s1 c3t0d0s1 -i 32b
#ls -l /dev/md/*/d0
lrwxrwxrwx   1 root   root   36 Nov6 17:29 /dev/md/dsk/d0 -> ../../../devices/pseudo/md@0:0,0,blk
lrwxrwxrwx   1 root   root   36 Nov6 17:29 /dev/md/rdsk/d0 -> ../../../devices/pseudo/md@0:0,0,raw

创建raid0串联卷(即创建2个条带,每个串联里有一个组件):
#metainit d0 2 1 c2t0d0s1 1 c3t0d0s1
d0: Concat/Stripe is setup
#metastat -p
d0 2 1 c2t0d0s1 \
         1 c3t0d0s1

创建raid0条带串联卷每个条带使用不同的交错大小(3个条带,每个串联里有2个组件,并且使用不同的交错大小)
#metainit d0 3 2 c2t0d0s1 c3t0d0s1 -i 64k 2 c2t0d0s3 c3t0d0s3 -i 32k 2 c2t0d0s5 c3t0d0s5 -i 16k
d0: Concat/Stripe is setup
#metastat -p
d0 3 2 c2t0d0s1 c3t0d0s1 -i 128b \
         2 c2t0d0s3 c3t0d0s3 -i 64b \
         2 c2t0d0s5 c3t0d0s5 -i 32b

通过raid0串联卷对普通分区文件系统扩容:
#newfs /dev/rdsk/c2t0d0s1
newfs: /dev/rdsk/c2t0d0s1 last mounted as /mnt
newfs: construct a new file system /dev/rdsk/c2t0d0s1: (y/n)? y
Warning: 2048 sector(s) in last cylinder unallocated
/dev/rdsk/c2t0d0s1:   4194304 sectors in 683 cylinders of 48 tracks, 128 sectors
      2048.0MB in 43 cyl groups (16 c/g, 48.00MB/g, 11648 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 98464, 196896, 295328, 393760, 492192, 590624, 689056, 787488, 885920,
3248288, 3346720, 3445152, 3543584, 3642016, 3740448, 3838880, 3937312,
4035744, 4134176
#mount /dev/dsk/c2t0d0s1 /mnt
#cd /mnt
#ls
lost+found
#touch testfile
#cd
#umount /mnt
#metainit d1 2 1 c2t0d0s1 1 c3t0d0s1    ###必须将c2t0d0s1放在第一个位置,否则原有文件系统的数据会丢失。
d1: Concat/Stripe is setup
#growfs /dev/md/rdsk/d1
Warning: 4096 sector(s) in last cylinder unallocated
/dev/md/rdsk/d1:      8388608 sectors in 1366 cylinders of 48 tracks, 128 sectors
      4096.0MB in 86 cyl groups (16 c/g, 48.00MB/g, 11648 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 98464, 196896, 295328, 393760, 492192, 590624, 689056, 787488, 885920,
7472672, 7571104, 7669536, 7767968, 7866400, 7964832, 8063264, 8161696,
8260128, 8358560
#mount /dev/md/
admindsk/   rdsk/
#mount /dev/md/dsk/d1 /mnt
#cd /mnt
#ls
lost+foundtestfile

raid0串联卷扩容当前的串联卷
#metastat -p
#metainit d0 1 1 c2t0d0s1
d0: Concat/Stripe is setup
#newfs /dev/md/rdsk/d0
newfs: /dev/md/rdsk/d0 last mounted as /mnt
newfs: construct a new file system /dev/md/rdsk/d0: (y/n)? y
/dev/md/rdsk/d0:      4194304 sectors in 1024 cylinders of 128 tracks, 32 sectors
      2048.0MB in 45 cyl groups (23 c/g, 46.00MB/g, 11264 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 94272, 188512, 282752, 376992, 471232, 565472, 659712, 753952, 848192,
3298432, 3392672, 3486912, 3581152, 3675392, 3769632, 3863872, 3958112,
4052352, 4146592
#mount /dev/md/dsk/d0 /mnt
#cd /mnt
#ls
lost+found
#touch testfile
#cd
#umount /mnt
#metattach d0 c3t0d0s1
d0: component is attached
#growfs /dev/md/rdsk/d0
Warning: inode blocks/cyl group (358) >= data blocks (256) in last
    cylinder group. This implies 4096 sector(s) cannot be allocated.
/dev/md/rdsk/d0:      8384512 sectors in 2047 cylinders of 128 tracks, 32 sectors
      4094.0MB in 89 cyl groups (23 c/g, 46.00MB/g, 11264 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 94272, 188512, 282752, 376992, 471232, 565472, 659712, 753952, 848192,
7444992, 7539232, 7633472, 7727712, 7821952, 7916192, 8010432, 8104672,
8198912, 8293152
#mount /dev/md/dsk/d0 /mnt
#df -lh |grep mnt
/dev/md/dsk/d0         3.9G   4.0M   3.8G   1%    /mnt
#cd /mnt
#ls
lost+foundtestfile

创建raid1卷:
#metainit d11 1 1 c2t0d0s1    ###创建子镜像d11
d11: Concat/Stripe is setup
#metainit d12 1 1 c3t0d0s1    ###创建子镜像d12
d12: Concat/Stripe is setup
#metainit d10 -m d11    ###创建镜像d10,第一个成员为d11
d10: Mirror is setup
#metattach d10 d12    ###附加第二个子镜像d12到d10
d10: submirror d12 is attached
#metastat -p
d10 -m d11 d12 1
d11 1 1 c2t0d0s1
d12 1 1 c3t0d0s1
#newfs /dev/md/rdsk/d10
newfs: construct a new file system /dev/md/rdsk/d10: (y/n)? y
/dev/md/rdsk/d10:       4194304 sectors in 1024 cylinders of 128 tracks, 32 sectors
      2048.0MB in 45 cyl groups (23 c/g, 46.00MB/g, 11264 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 94272, 188512, 282752, 376992, 471232, 565472, 659712, 753952, 848192,
3298432, 3392672, 3486912, 3581152, 3675392, 3769632, 3863872, 3958112,
4052352, 4146592

创建raid1+0卷:
#metainit d11 1 2 c2t0d0s1c3t0d0s1
d11: Concat/Stripe is setup
#metainit d12 1 2 c2t0d0s3c3t0d0s3
d12: Concat/Stripe is setup
#metainit d10 -m d11
d10: Mirror is setup
#metattach d10 d12
d10: submirror d12 is attached
#metastat -p
d10 -m d11 d12 1
d11 1 2 c2t0d0s1 c3t0d0s1 -i 32b
d12 1 2 c2t0d0s3 c3t0d0s3 -i 32b
#metastat d10
d10: Mirror
    Submirror 0: d11
      State: Okay      
    Submirror 1: d12               ###d12状态resyncing
      State: Resyncing   
    Resync in progress: 2 % done
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 8388608 blocks (4.0 GB)

d11: Submirror of d10
    State: Okay      
    Size: 8388608 blocks (4.0 GB)
    Stripe 0: (interlace: 32 blocks)
      Device   Start BlockDbase      State Reloc Hot Spare
      c2t0d0s1          0   No            Okay   Yes
      c3t0d0s1          0   No            Okay   Yes

d12: Submirror of d10
    State: Resyncing   
    Size: 8388608 blocks (4.0 GB)
    Stripe 0: (interlace: 32 blocks)
      Device   Start BlockDbase      State Reloc Hot Spare
      c2t0d0s3          0   No            Okay   Yes
      c3t0d0s3          0   No            Okay   Yes

Device Relocation Information:
Device   RelocDevice ID
c2t0d0   Yes    id1,sd@n6000c29e5f98b5bb3fb5263cf1c524c6
c3t0d0   Yes    id1,sd@n6000c2982f7aef8afeb682a73edccd6a

为现有的文件系统(可umount)创建raid1卷:
#newfs /dev/rdsk/c2t0d0s1
newfs: construct a new file system /dev/rdsk/c2t0d0s1: (y/n)? y
Warning: 2048 sector(s) in last cylinder unallocated
/dev/rdsk/c2t0d0s1:   4194304 sectors in 683 cylinders of 48 tracks, 128 sectors
      2048.0MB in 43 cyl groups (16 c/g, 48.00MB/g, 11648 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 98464, 196896, 295328, 393760, 492192, 590624, 689056, 787488, 885920,
3248288, 3346720, 3445152, 3543584, 3642016, 3740448, 3838880, 3937312,
4035744, 4134176
#mount /dev/dsk/c2t0d0s1 /test
#cd /test
#ls
lost+found
#touch testfile
#umount /test
#metainit -f d1 1 1 c2t0d0s1    ###对在线的文件系统强制创建子镜像卷d1
d1: Concat/Stripe is setup
#metainit d2 1 1 c3t0d0s1    ###创建第二个子镜像d2
d2: Concat/Stripe is setup
#metainit d0 -m d1    ###创建raid1镜像d0,并且第一个卷为d1
d0: Mirror is setup
#umount /test
#metattach d0 d2
d0: submirror d2 is attached
#metastat -p
d0 -m d1 d2 1
d1 1 1 c2t0d0s1
d2 1 1 c3t0d0s1
#mount /dev/md/dsk/d0 /test
#cd /test/
#ls
lost+foundtestfile

为swap(不能umount)创建raid1镜像:
#metainit -f d1 1 1 c1t0d0s1    ###swap所在的分区作为第一个子镜像卷d1
d1: Concat/Stripe is setup
#metainit d2 1 1 c2t0d0s1    ###创建第二个子镜像卷d2
d2: Concat/Stripe is setup
#metainitd0 -m d1    ###创建raid1镜像d0,并且第一个卷为d1
d0: Mirror is setup
#vi /etc/vfstab
/dev/md/dsk/d0-       -       swap    -       no      -   ###将原来的分区替换为镜像d0
#reboot
#metastat -p
d0 -m d1 1
d1 1 1 c1t0d0s1
d2 1 1 c2t0d0s1
#metattach d0 d2
d0: submirror d2 is attached
#metastat -p
d0 -m d1 d2 1
d1 1 1 c1t0d0s1
d2 1 1 c2t0d0s1

x86平台为/创建raid1镜像:
#metainit -f d1 1 1 c1t0d0s0   ###/所在的分区作为第一个子镜像卷d1
d1: Concat/Stripe is setup
#metainitd2 1 1 c1t1d0s0   ###创建第二个子镜像d2
d2: Concat/Stripe is setup
#metastat -p
d2 1 1 c1t1d0s0
d1 1 1 c1t0d0s0
#metainit d0 -m d1    ###创建raid1镜像d0,并且第一个卷为d1
d0: Mirror is setup
#metaroot d0   ###为d0安装metaroot信息   
#lockfs -fa   ###锁定文件系统,并且flush所有的脏数据
#reboot
#metattach d0 d2
d0: submirror d2 is attached
#metastat -p
d0 -m d1 d2 1
d1 1 1 c1t0d0s0
d2 1 1 c1t1d0s0
#ls -l /dev/dsk/c1t1d0s0   ###将第二个子镜像作为备用启动
lrwxrwxrwx   1 root   root          46 Nov6 22:29 /dev/dsk/c1t1d0s0 ->

../../devices/pci@0,0/pci15ad,1976@10/sd@1,0:a
#eeprom altbootpath=/devices/pci@0,0/pci15ad,1976@10/sd@1,0:a
#fdisk -b /usr/lib/fs/ufs/mboot /dev/rdsk/c1t1d0p0
             Total disk size is 2088 cylinders
             Cylinder size is 16065 (512 byte) blocks

                                             Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    =================   ===   ======   ===
          1       Active    Solaris2          12087    2087    100


SELECT ONE OF THE FOLLOWING:
   1. Create a partition
   2. Specify the active partition
   3. Delete a partition
   4. Change between Solaris and Solaris2 Partition IDs
   5. Exit (update disk configuration and exit)
   6. Cancel (exit without updating disk configuration)
Enter Selection: 5
#installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c1t1d0s0    ###由于intabllboot被intallgrub取代,因此这里使用installgrub来安装stage1和stage2
stage1 written to partition 0 sector 0 (abs 16065)
stage2 written to partition 0, 273 sectors starting at 50 (abs 16115)

更换故障的slice
#metastat -p
d10 -m d11 d12 1
d11 1 2 c2t0d0s1 c3t0d0s1 -i 32b
d12 1 2 c2t0d0s3 c3t0d0s3 -i 32b
#metareplace d10 c3t0d0s1 c3t0d0s4
d10: device c3t0d0s1 is replaced with c3t0d0s4
#metastat -p
d10 -m d11 d12 1
d11 1 2 c2t0d0s1 c3t0d0s4 -i 32b
d12 1 2 c2t0d0s3 c3t0d0s3 -i 32b
d0 -m d1 d2 1
d1 1 1 c1t0d0s0
d2 1 1 c1t1d0s0
#metastat d10
d10: Mirror
    Submirror 0: d11
      State: Resyncing   
    Submirror 1: d12
      State: Okay         
    Resync in progress: 5 % done
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 8388608 blocks (4.0 GB)

d11: Submirror of d10
    State: Resyncing   
    Size: 8388608 blocks (4.0 GB)
    Stripe 0: (interlace: 32 blocks)
      Device   Start BlockDbase      State Reloc Hot Spare
      c2t0d0s1          0   No            Okay   Yes
      c3t0d0s4          0   No       Resyncing   Yes


d12: Submirror of d10
    State: Okay         
    Size: 8388608 blocks (4.0 GB)
    Stripe 0: (interlace: 32 blocks)
      Device   Start BlockDbase      State Reloc Hot Spare
      c2t0d0s3          0   No            Okay   Yes
      c3t0d0s3          0   No            Okay   Yes


Device Relocation Information:
Device   RelocDevice ID
c2t0d0   Yes    id1,sd@n6000c29e5f98b5bb3fb5263cf1c524c6
c3t0d0   Yes    id1,sd@n6000c2982f7aef8afeb682a73edccd6a

raid1卷扩容:
#metainit d11 1 1 c2t0d0s1
d11: Concat/Stripe is setup
#metainit d12 1 1 c3t0d0s1
d12: Concat/Stripe is setup
#metainit d10 -m d11
d10: Mirror is setup
#metattach d10 d12
d10: submirror d12 is attached
#metastat d10
d10: Mirror
    Submirror 0: d11
      State: Okay      
    Submirror 1: d12
      State: Resyncing   
    Resync in progress: 6 % done
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 4194304 blocks (2.0 GB)

d11: Submirror of d10
    State: Okay      
    Size: 4194304 blocks (2.0 GB)
    Stripe 0:
      Device   Start BlockDbase      State Reloc Hot Spare
      c2t0d0s1          0   No            Okay   Yes

d12: Submirror of d10
    State: Resyncing   
    Size: 4194304 blocks (2.0 GB)
    Stripe 0:
      Device   Start BlockDbase      State Reloc Hot Spare
      c3t0d0s1          0   No            Okay   Yes

Device Relocation Information:
Device   RelocDevice ID
c2t0d0   Yes    id1,sd@n6000c29e5f98b5bb3fb5263cf1c524c6
c3t0d0   Yes    id1,sd@n6000c2982f7aef8afeb682a73edccd6a
#metattach d11 c2t0d0s3
d11: component is attached
metattach: Solaris: d10: growing of metadevice delayed
#metattach d12 c3t0d0s3
d12: component is attached
#metastat d10
d10: Mirror
    Submirror 0: d11
      State: Okay      
    Submirror 1: d12
      State: Resyncing   
    Resync in progress: 66 % done
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 4194304 blocks (2.0 GB)

d11: Submirror of d10
    State: Okay      
    Size: 8388608 blocks (4.0 GB)
    Stripe 0:
      Device   Start BlockDbase      State Reloc Hot Spare
      c2t0d0s1          0   No            Okay   Yes
    Stripe 1:
      Device   Start BlockDbase      State Reloc Hot Spare
      c2t0d0s3          0   No            Okay   Yes


d12: Submirror of d10
    State: Resyncing   
    Size: 8388608 blocks (4.0 GB)
    Stripe 0:
      Device   Start BlockDbase      State Reloc Hot Spare
      c3t0d0s1          0   No            Okay   Yes
    Stripe 1:
      Device   Start BlockDbase      State Reloc Hot Spare
      c3t0d0s3          0   No            Okay   Yes


Device Relocation Information:
Device   RelocDevice ID
c2t0d0   Yes    id1,sd@n6000c29e5f98b5bb3fb5263cf1c524c6
c3t0d0   Yes    id1,sd@n6000c2982f7aef8afeb682a73edccd6a
#metattach d10
#metastat d10
d10: Mirror
    Submirror 0: d11
      State: Okay      
    Submirror 1: d12
      State: Okay      
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 8388608 blocks (4.0 GB)

d11: Submirror of d10
    State: Okay      
    Size: 8388608 blocks (4.0 GB)
    Stripe 0:
      Device   Start BlockDbase      State Reloc Hot Spare
      c2t0d0s1          0   No            Okay   Yes
    Stripe 1:
      Device   Start BlockDbase      State Reloc Hot Spare
      c2t0d0s3          0   No            Okay   Yes

d12: Submirror of d10
    State: Okay      
    Size: 8388608 blocks (4.0 GB)
    Stripe 0:
      Device   Start BlockDbase      State Reloc Hot Spare
      c3t0d0s1          0   No            Okay   Yes
    Stripe 1:
      Device   Start BlockDbase      State Reloc Hot Spare
      c3t0d0s3          0   No            Okay   Yes

Device Relocation Information:
Device   RelocDevice ID
c3t0d0   Yes    id1,sd@n6000c2982f7aef8afeb682a73edccd6a
c2t0d0   Yes    id1,sd@n6000c29e5f98b5bb3fb5263cf1c524c6
c1t1d0   Yes    id1,sd@n6000c29cc60ef436309c688c80a0880a
c1t0d0   Yes    id1,sd@n6000c297b0d86f9e7c02a2710f66ceaa

删除/的raid1卷:
#metastat -p
d0 -m d1 d2 1
d1 1 1 c1t0d0s0
d2 1 1 c1t1d0s0
#metadetach d0 d2
d0: submirror d2 is detached
#metaroot /dev/dsk/c1t0d0s0    ###安装metaroot到c1t0d0s0(未创建raid1前的slice)
#reboot
#metaclear -r d0
d0: Mirror is cleared
d1: Concat/Stripe is cleared
#metaclear -r d2
d2: Concat/Stripe is cleared
#metastat -p


milujite 发表于 2011-11-24 15:13

软分区扩容:
#metainit d1 2 1 c2t0d0s1 1 c3t0d0s1
d1: Concat/Stripe is setup
#metainit d2 2 1 c2t0d0s3 1 c3t0d0s3
d2: Concat/Stripe is setup
#metastat -p
d2 2 1 c2t0d0s3 \
         1 c3t0d0s3
d1 2 1 c2t0d0s1 \
         1 c3t0d0s1
#
#metainit d0 -m d1
d0: Mirror is setup
#metattach d0 d2
d0: submirror d2 is attached
#metastat -p
d0 -m d1 d2 1
d1 2 1 c2t0d0s1 \
         1 c3t0d0s1
d2 2 1 c2t0d0s3 \
         1 c3t0d0s3
#metastat d0
d0: Mirror
    Submirror 0: d1
      State: Okay      
    Submirror 1: d2
      State: Resyncing   
    Resync in progress: 2 % done
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 8388608 blocks (4.0 GB)

d1: Submirror of d0
    State: Okay      
    Size: 8388608 blocks (4.0 GB)
    Stripe 0:
      Device   Start BlockDbase      State Reloc Hot Spare
      c2t0d0s1          0   No            Okay   Yes
    Stripe 1:
      Device   Start BlockDbase      State Reloc Hot Spare
      c3t0d0s1          0   No            Okay   Yes

d2: Submirror of d0
    State: Resyncing   
    Size: 8388608 blocks (4.0 GB)
    Stripe 0:
      Device   Start BlockDbase      State Reloc Hot Spare
      c2t0d0s3          0   No            Okay   Yes
    Stripe 1:
      Device   Start BlockDbase      State Reloc Hot Spare
      c3t0d0s3          0   No            Okay   Yes

Device Relocation Information:
Device   RelocDevice ID
c2t0d0   Yes    id1,sd@n6000c29e5f98b5bb3fb5263cf1c524c6
c3t0d0   Yes    id1,sd@n6000c2982f7aef8afeb682a73edccd6a
#metainit d101 -p d0 2g
d101: Soft Partition is setup
#metastat -p
d101 -p d0 -o 32 -b 4194304
d0 -m d1 d2 1
d1 2 1 c2t0d0s1 \
         1 c3t0d0s1
d2 2 1 c2t0d0s3 \
         1 c3t0d0s3
#metastat d101
d101: Soft Partition
    Device: d0
    State: Okay
    Size: 4194304 blocks (2.0 GB)
      Extent            Start Block            Block count
             0                     32                  4194304

d0: Mirror
    Submirror 0: d1
      State: Okay      
    Submirror 1: d2
      State: Resyncing   
    Resync in progress: 51 % done
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 8388608 blocks (4.0 GB)

d1: Submirror of d0
    State: Okay      
    Size: 8388608 blocks (4.0 GB)
    Stripe 0:
      Device   Start BlockDbase      State Reloc Hot Spare
      c2t0d0s1          0   No            Okay   Yes
    Stripe 1:
      Device   Start BlockDbase      State Reloc Hot Spare
      c3t0d0s1          0   No            Okay   Yes

d2: Submirror of d0
    State: Resyncing   
    Size: 8388608 blocks (4.0 GB)
    Stripe 0:
      Device   Start BlockDbase      State Reloc Hot Spare
      c2t0d0s3          0   No            Okay   Yes
    Stripe 1:
      Device   Start BlockDbase      State Reloc Hot Spare
      c3t0d0s3          0   No            Okay   Yes

Device Relocation Information:
Device   RelocDevice ID
c2t0d0   Yes    id1,sd@n6000c29e5f98b5bb3fb5263cf1c524c6
c3t0d0   Yes    id1,sd@n6000c2982f7aef8afeb682a73edccd6a
#newfs /dev/md/rdsk/d101
newfs: construct a new file system /dev/md/rdsk/d101: (y/n)? y
/dev/md/rdsk/d101:      4194304 sectors in 1024 cylinders of 128 t
      2048.0MB in 45 cyl groups (23 c/g, 46.00MB/g, 11264 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 94272, 188512, 282752, 376992, 471232, 565472, 659712, 753952
3298432, 3392672, 3486912, 3581152, 3675392, 3769632, 3863872, 39
4052352, 4146592
#mount /dev/md/dsk/d101 /mnt
c#cd /mnt
#ls
lost+found
#touch testfile
#cd
#metattach d101 1g
d101: Soft Partition has been grown
#growfs -M /mnt /dev/md/rdsk/d101
/dev/md/rdsk/d101:      6291456 sectors in 1536 cylinders of 128 tracks, 32 sectors
      3072.0MB in 67 cyl groups (23 c/g, 46.00MB/g, 11264 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 94272, 188512, 282752, 376992, 471232, 565472, 659712, 753952, 848192,
5371712, 5465952, 5560192, 5654432, 5748672, 5842912, 5937152, 6031392,
6125632, 6219872
#df -lh |grep mnt
mnttab                   0K   0K   0K   0%    /etc/mnttab
/dev/md/dsk/d101       2.9G   3.0M   2.8G   1%    /mnt
#ls -l /mnt
total 16
drwx------   2 root   root      8192 Nov7 15:08 lost+found
-rw-r--r--   1 root   root         0 Nov7 15:26 testfile

创建raid5卷:
#metainit d0 -r c2t0d0s1 c3t0d0s1 c2t0d0s3 c3t0d0s3 -i 32k
d0: RAID is setup
#metastat -p
d0 -r c2t0d0s1 c3t0d0s1 c2t0d0s3 c3t0d0s3 -k -i 64b
#metastat d0
d0: RAID
    State: Initializing
    Initialization in progress:3.0% done
    Interlace: 64 blocks
    Size: 12578816 blocks (6.0 GB)
Original device:
    Size: 12580800 blocks (6.0 GB)
      Device   Start BlockDbase      State RelocHot Spare
      c2t0d0s1      650      No Initializing   Yes
      c3t0d0s1      650      No Initializing   Yes
      c2t0d0s3      650      No Initializing   Yes
      c3t0d0s3      650      No Initializing   Yes

Device Relocation Information:
Device   RelocDevice ID
c2t0d0   Yes    id1,sd@n6000c29e5f98b5bb3fb5263cf1c524c6
c3t0d0   Yes    id1,sd@n6000c2982f7aef8afeb682a73edccd6a

raid5卷替换分区:
#metareplace d0 c2t0d0s4 c3t0d0s4
d0: device c2t0d0s4 is replaced with c3t0d0s4
#metastat d0
d0: RAID
    State: Resyncing   
    Resync in progress:2.0% done
    Interlace: 64 blocks
    Size: 16773120 blocks (8.0 GB)
Original device:
    Size: 12580800 blocks (6.0 GB)
      Device   Start BlockDbase      State RelocHot Spare
      c2t0d0s1      650      No         Okay   Yes
      c3t0d0s1      650      No         Okay   Yes
      c2t0d0s3      650      No         Okay   Yes
      c3t0d0s3      650      No         Okay   Yes
Concatenated Devices:
    Size: 4193600 blocks (2.0 GB)
      Device   Start BlockDbase State      Reloc Hot Spare
      c3t0d0s4      650      No    Resyncing   Yes

Device Relocation Information:
Device   RelocDevice ID
c2t0d0   Yes    id1,sd@n6000c29e5f98b5bb3fb5263cf1c524c6

创建热备池:
#metainit hsp01 c2t0d0s4 c3t0d0s4
hsp001: Hotspare pool is setup
#metastat hsp001
hsp001: 2 hot spares
      Device   Status      Length         Reloc
      c2t0d0s4   Available    4194304 blocksYes
      c3t0d0s4   Available    4194304 blocksYes

Device Relocation Information:
Device   RelocDevice ID
c2t0d0   Yes    id1,sd@n6000c29e5f98b5bb3fb5263cf1c524c6
c3t0d0   Yes    id1,sd@n6000c2982f7aef8afeb682a73edccd6a

c3t0d0   Yes    id1,sd@n6000c2982f7aef8afeb682a73edccd6a

solarisplayer 发表于 2011-11-24 15:16

扶持 楼主!:mrgreen:

沙中有金 发表于 2011-11-24 20:25

svm真的很烂,用的时候会查就行了

财版 发表于 2011-11-25 10:36

svm真的很烂,用的时候会查就行了:outu:

milujite 发表于 2011-11-25 13:33

SVM还行啊,跟AIX的VM比那确实是差了。不过都差不多~好在SOLARIS还有ZFS~

alex_xie 发表于 2011-11-25 16:46

楼主威武

hzg1103 发表于 2012-06-19 20:33

补充:raid1卷扩容
如果d10已经被挂载在/files下,还需要
growfs -M /files /dev/md/rdsk/d0
来扩展文件系统。
要不然即使metastat里看到d0扩展了,但df -h看到的/dev/md/rdsk/d0还是原始大小。
亲测!

微弱的星光 发表于 2013-09-24 17:48

新手学习中!感谢楼主,有很大帮助

itchaoren 发表于 2013-12-31 10:33

学习中,感谢楼主分享
对新手有很大帮助
页: [1]
查看完整版本: solaris 10用SVM创建各种卷例子