Solaris10下在线扩容操作成功实例(原创)
1。现状
系统信息:
Solaris 10 11/06 s10s_u3wos_10 SPARC
Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
Use is subject to license terms.
Assembled 14 November 2006
SunOS sunday 5.10 Generic_141444-09 sun4v sparc SUNW,Sun-Fire-T2000
UFS信息:
Filesystem size used avail capacity Mounted on
/dev/dsk/c0t0d0s0 15G 15G 0K 100% /
...
/dev/dsk/c0t1d0s6 67G 1.1G 65G 2% /export/home2
VFSTAB:
/etc/vfstab
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
fd - /dev/fd fd - no -
/proc - /proc proc - no -
/dev/dsk/c0t0d0s1 - - swap - no -
/dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0 / ufs 1 no logging
...
/dev/dsk/c0t1d0s6 /dev/rdsk/c0t1d0s6 /export/home2 ufs 3 yes -
磁盘信息:
AVAILABLE DISK SELECTIONS:
0. c0t0d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
/pci@780/pci@0/pci@9/scsi@0/sd@0,0
1. c0t1d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
/pci@780/pci@0/pci@9/scsi@0/sd@1,0
Specify disk (enter its number): 1
selecting c0t1d0
[disk formatted]
Warning: Current Disk has mounted partitions.
/dev/dsk/c0t1d0s6 is currently mounted on /export/home2. Please see umount(1M).
format> current
Current Disk = c0t1d0
<SUN72G cyl 14087 alt 2 hd 24 sec 424>
/pci@780/pci@0/pci@9/scsi@0/sd@1,0
format> verify
Volume name = < >
Part Tag Flag Cylinders Size Blocks
0 root wm 0 - 25 129.19MB (26/0/0) 264576
1 swap wu 26 - 51 129.19MB (26/0/0) 264576
2 backup wu 0 - 14086 68.35GB (14087/0/0) 143349312
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 usr wm 52 - 14086 68.10GB (14035/0/0) 142820160
7 unassigned wm 0 0 (0/0/0) 0
format>
2。现状
T0: c0t0d0(72G) 是系统分区盘,
T1: c0t1d0(72G)是数据盘[前人装的当时直接newfs就挂给export/home2了],
T2: 还有块没plugin的新硬盘(146G)
方便起见,分别命名为T0,T1,T2
3。要求
(因为此ufs已经通过share到网络中,给其他机器作ufs和samba了,
所以不想改变原有数据)
由于T1空间日益减少(以后迟早要变小- -!),所以新购置了一块sun的146G的硬盘T2,
想要在保留T1中所有数据的前提下,把T2和T1串起来(带状Raid0?)
挂载给/export/home2,使其扩容。
开始操作!
在 /export/home2(c0t1d0s6)数据保留的情况下, 把另外的硬盘的剩余空间c0t0d0s3拉过来扩容
成功。分区情况:
c0t0d0: 剩余空间分区 s3 49.2G
metadb分区 s4 149M
c0t1d0: 剩余空间分区 s6 68.25G
metadb分区 s7 104M
0.已挂载s6
#df -h
Filesystem size used avail capacity Mounted on
。。。
/dev/dsk/c0t1d0s6 67G 64M 66G 1% /export/home2
。。。
# pwd
/export/home2
# ls
lost+found test
# more test
abcdefg 123456789
q
1。建立metadb备份
# metadb -a -f -c 2 c0t0d0s7
# metadb -a -f -c 2 c0t0d0s4
# metadb
flags first blk block count
a u 16 8192 /dev/dsk/c0t1d0s7
a u 8208 8192 /dev/dsk/c0t1d0s7
a u 16 8192 /dev/dsk/c0t0d0s4
a u 8208 8192 /dev/dsk/c0t0d0s4
# metastat
2。建立条状串连(T1的s6数据必须在挂载状态)
# metainit -f d0 2 1 c0t1d0s6 1 c0t0d0s3
d0: Concat/Stripe is setup
# metastat
d0: Concat/Stripe
Size: 246320256 blocks (117 GB)
Stripe 0:
Device Start Block Dbase Reloc
c0t1d0s6 0 No Yes
Stripe 1:
Device Start Block Dbase Reloc
c0t0d0s3 0 No Yes
Device Relocation Information:
Device Reloc Device ID
c0t1d0 Yes id1,sd@n5000cca0007a5690
c0t0d0 Yes id1,sd@n5000cca00083a334
查看建立以后空间大小改变没
# df -h
Filesystem size used avail capacity Mounted on
。。。
/dev/dsk/c0t1d0s6 67G 64M 66G 1% /export/home2
。。。
3。更新dev src 条状串联
# umount /export/home2
# mount /dev/md/dsk/d0 /export/home2
# df -h
Filesystem size used avail capacity Mounted on
/dev/md/dsk/d0 67G 64M 66G 1% /export/home2
大小未变,按照预定计划,把T0的s3头部连在了T1的s6的尾部
# ls -lp
total 8
drwxr-xr-x 3 root root 512 Apr 24 2009 home/
drwxr-xr-x 2 root root 512 Jan 7 10:23 home1/
drwxr-xr-x 3 root root 512 Jan 7 13:09 home2/
drwxr-xr-x 2 root root 512 Mar 31 2009 install/
# cd home2
# ls
lost+found test
# more test
abcdefg 123456789
q
数据都保留了
# cd /export
# ls
home home1 home2 install
# pwd
/export
4.扩容在线设备
# growfs -M /export/home2 /dev/md/rdsk/d0
Warning: 4992 sector(s) in last cylinder unallocated
/dev/md/rdsk/d0: 246320256 sectors in 40092 cylinders of 48 tracks, 128 sectors
120273.6MB in 2506 cyl groups (16 c/g, 48.00MB/g, 5824 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 98464, 196896, 295328, 393760, 492192, 590624, 689056, 787488, 885920,
Initializing cylinder groups:
.................................................
super-block backups for last 10 cylinder groups at:
245366816, 245465248, 245563680, 245662112, 245760544, 245858976, 245957408,
246055840, 246154272, 246252704
完成
# df -h
Filesystem size used avail capacity Mounted on
/dev/dsk/c0t0d0s0 15G 10G 4.3G 71% /
。。。
/dev/md/dsk/d0 116G 64M 115G 1% /export/home2
。。。
# pwd
/export
# cd home2
# ls
lost+found test
# more test
abcdefg 123456789
q
为了能reboot后自动挂载,修改原mount point 和 device
# vi /etc/vfstab
"/etc/vfstab" 13 lines, 493 characters
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
。。。
/dev/md/dsk/d0 /dev/md/rdsk/d0 /export/home2 ufs 3 yes -
。。。
~
"/etc/vfstab" 13 lines, 486 characters