免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1343 | 回复: 0
打印 上一主题 下一主题

Expand a File System With a Single Stripe [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-06-15 17:07 |只看该作者 |倒序浏览

How to Expand a File System With a Single Stripe, On the Fly
First, the file system has to be created and mounted as a one-way mirror metadevice; as in this example, with d80 mounted by /opt:
   # metastat d80
   d80: Mirror
       Submirror 0: d81
         State: Okay
       Pass: 1
       Read option: roundrobin (default)
       Write option: parallel (default)
       Size: 10261520 blocks
   d81: Submirror of d80
       State: Okay
       Size: 10261520 blocks
       Stripe 0: (interlace: 32 blocks)
           Device              Start Block  Dbase State        Hot Spare
           c1t12d0s0                  0     No    Okay
           c1t13d0s0               1520     No    Okay
           c1t14d0s0               1520     No    Okay
           c1t15d0s0               1520     No    Okay
Next, use the metattach command to dynamically concatenate a new slice, /dev/dsk/c0t1d0s1, to the end of the existing submirror of d80, d81:
   # metattach d81 c0t1d0s1
   # metastat d80
   d80: Mirror
       Submirror 0: d81
         State: Okay
       Pass: 1
       Read option: roundrobin (default)
       Write option: parallel (default)
       Size: 10261520 blocks
   d81: Submirror of d80
       State: Okay
       Size: 10261520 blocks
       Stripe 0: (interlace: 32 blocks)
           Device              Start Block  Dbase State        Hot Spare
           c1t12d0s0                  0     No    Okay
           c1t13d0s0               1520     No    Okay
           c1t14d0s0               1520     No    Okay
           c1t15d0s0               1520     No    Okay
       Stripe 1:
           Device              Start Block  Dbase State        Hot Spare
           c0t1d0s1                   0     No    Okay
Then, use the growfs command to expand the mounted file system ( /opt) onto the raw metadevice /dev/md/rdsk/d80:
# growfs -M /opt /dev/md/rdsk/d80
/dev/md/rdsk/d80: 12336320 sectors in 8116 cylinders of 19 tracks,
   80 sectors
           6023.6MB in 129 cyl groups (63 c/g, 46.76MB/g, 5888 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 95872, 191712, 287552, 383392, 479232, 575072, 670912, 766752, 862592,
958432, 1054272, 1150112, 1245952, 1341792, 1437632, 1533472, 1629312,
1725152, 1820992, 1916832, 2012672, 2108512, 2204352, 2300192, 2396032,
2491872, 2587712, 2683552, 2779392, 2875232, 2971072, 3064352, 3160192,
3256032, 3351872, 3447712, 3543552, 3639392, 3735232, 3831072, 3926912,
4022752, 4118592, 4214432, 4310272, 4406112, 4501952, 4597792, 4693632,
4789472, 4885312, 4981152, 5076992, 5172832, 5268672, 5364512, 5460352,
5556192, 5652032, 5747872, 5843712, 5939552, 6035392, 6128672, 6224512,
6320352, 6416192, 6512032, 6607872, 6703712, 6799552, 6895392, 6991232,
7087072, 7182912, 7278752, 7374592, 7470432, 7566272, 7662112, 7757952,
7853792, 7949632, 8045472, 8141312, 8237152, 8332992, 8428832, 8524672,
8620512, 8716352, 8812192, 8908032, 9003872, 9099712, 9192992, 9288832,
9384672, 9480512, 9576352, 9672192, 9768032, 9863872, 9959712, 10055552,
10151392, 10247232, 10343072, 10438912, 10534752, 10630592, 10726432,
10822272, 10918112, 11013952, 11109792, 11205632, 11301472, 11397312,
11493152, 11588992, 11684832, 11780672, 11876512, 11972352, 12068192,
12164032, 12257312,
Now the file system (/opt) has been expanded dynamically, but it contains two stripes: stripe 0, which is the original one, and stripe 1, which is the expanded one.
The next step is to create a single stripe metadevice d82, which is the same size as the submirror d81.
In the following example, we create a stripe with three 2.1-Gbyte disks:
   # metainit d82 1 3 c0t11d0s2 c0t12d0s2 c0t13d0s2
   d82: Concat/Stripe is setup
   # metastat d82
   d82: Concat/Stripe
       Size: 12457920 blocks
       Stripe 0: (interlace: 32 blocks)
           Device              Start Block  Dbase
           c0t11d0s2                  0     No
           c0t12d0s2               1520     No
           c0t13d0s2               1520     No
Then, add the metadevice d82 as the second submirror to d80, and resync will automatically take place:
   # metattach d80 d82
   d80: submirror d82 is attached
   # metastat d80
   d80: Mirror
       Submirror 0: d81
         State: Okay
       Submirror 1: d82
         State: Resyncing
       Resync in progress: 20 % done
       Pass: 1
       Read option: roundrobin (default)
       Write option: parallel (default)
       Size: 12336320 blocks
   ......
After the resync is complete, we have the following two-way mirrors:
   # metastat d80
   d80: Mirror
       Submirror 0: d81
         State: Okay
       Submirror 1: d82
         State: Okay
       Pass: 1
       Read option: roundrobin (default)
       Write option: parallel (default)
       Size: 12336320 blocks
   d81: Submirror of d80
       State: Okay
       Size: 12336320 blocks
       Stripe 0: (interlace: 32 blocks)
           Device              Start Block  Dbase State        Hot Spare
           c1t12d0s0                  0     No    Okay
           c1t13d0s0               1520     No    Okay
           c1t14d0s0               1520     No    Okay
           c1t15d0s0               1520     No    Okay
       Stripe 1:
           Device              Start Block  Dbase State        Hot Spare
           c0t1d0s1                   0     No    Okay
   d82: Submirror of d80
       State: Okay
       Size: 12336320 blocks
       Stripe 0: (interlace: 32 blocks)
           Device              Start Block  Dbase State        Hot Spare
           c0t11d0s2                  0     No    Okay
           c0t12d0s2               1520     No    Okay
           c0t13d0s2               1520     No    Okay
Finally, you can detach the submirror d81 from d80, and remove it completely:
   # metadetach d80 d81
   # metaclear d81
   # metastat d80
   d80: Mirror
       Submirror 1: d82
         State: Okay
       Pass: 1
       Read option: roundrobin (default)
       Write option: parallel (default)
       Size: 12336320 blocks
   d82: Submirror of d80
       State: Okay
       Size: 12336320 blocks
       Stripe 0: (interlace: 32 blocks)
           Device              Start Block  Dbase State        Hot Spare
           c0t11d0s2                  0         No        Okay
           c0t12d0s2               1520     No        Okay
           c0t13d0s2               1520     No        Okay
Now, you have dynamically expanded the file system (/opt) with a single stripe metadevice.
Reference:http://www.sun.com/bigadmin/content/submitted/expand_filesystem.html


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/26090/showart_322082.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP