- 论坛徽章:
- 0
|
拆除现有镜像
root@xz_netman # cd /etc
root@xz_netman # ls //下面输出有删减
LGTOuscsi nsswitch.conf
TIMEZONE nsswitch.dns
log syslog.pid
logindevperm system
lp system-INSTALL
lu tar
lvm telinit
name_to_major utmpx
name_to_sysnum uucp
nca vfstab
ncheck vfstab-INSTALL
net volcopy
netconfig vold.conf
root@xz_netman # more vfstab-I* //确认是否为镜像前的内容
root@xz_netman # more system-I* //确认是否为镜像前的内容
root@xz_netman # cp vfstab vfstab.bak //备份现有的vfstab
root@xz_netman # cp system system.bak //备份现有的system文件,供故障时还原
root@xz_netman # more system.bak //确认备份成功
root@xz_netman # more vfstab.bak
root@xz_netman # format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c1t0d0 <SUN36G cyl 24620 alt 2 hd 27 sec 107>
/pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000004cfc333eb,0
1. c1t1d0 <SUN36G cyl 24620 alt 2 hd 27 sec 107>
/pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000004cfc333ff,0
Specify disk (enter its number): ^D
root@xz_netman # prtconf -vp|grep bootpath //查看当前启动盘为0号盘
bootpath: '/pci@8,600000/SUNW,qlc@4/fp@0,0/disk@w21000004cfc333eb,0:a'
********************************************************************************
说明:因为当前的启动盘为0号盘,所以无法删0号盘上的故障子镜像,如果此时试图删除子镜像d11,会报一个错,如:
root@xz_netman # metadetach d10 d11
metadetach: xz_netman: d10: attempt an operation on a submirror that has erred components
必须先把系统启动到1号盘上,在进行删除。而要想从1号盘启动系统,现有的镜像不能拆。
*******************************************************************************
root@xz_netman # init 0
ok boot disk1
root@xz_netman#format
root@xz_netman # prtconf -vp|grep bootpath //确认启动盘是否为1号盘
root@xz_netman # metastat //再次确认镜像状态
root@xz_netman # metadetach -f d10 d11
d10: submirror d11 is detached
//删除处于需要维护状态的子镜像必须加-f参数进行强制删除
root@xz_netman # metaclear d11
d11: Concat/Stripe is cleared
root@xz_netman # metadetach d20 d21
d20: submirror d21 is detached
root@xz_netman # metaclear d21
d21: Concat/Stripe is cleared
root@xz_netman # metastat //确认0号盘上的子镜像已经全部删除
注:此处把0号盘上的子镜像删除,是因为防止把1号盘上的系统dump完成后,如果0号盘子镜像不删除,在最后重新同步镜像时可能会出错。
3.3 更换硬盘并分区
root@xz_netman # luxadm remove_device -F /dev/rdsk/c1t0d0s2 //逻辑上剔出0号盘
WARNING!!! Please ensure that no filesystems are mounted on these device(s).
All data on these devices should have been backed up.
The list of devices which will be removed is:
1: Device name: /dev/rdsk/c1t0d0s2
Node WWN: 20000004cfc333eb
Device Typeisk device
Device Paths:
/dev/rdsk/c1t0d0s
Please verify the above list of devices and
then enter 'c' or <CR> to Continue or 'q' to Quit. [Default: c]:
stopping: /dev/rdsk/c1t0d0s2....Done
offlining: /dev/rdsk/c1t0d0s2....Done
Hit <Return> after removing the device(s). //此时拔掉0号盘,并按回车
Device: /dev/rdsk/c1t0d0s2
Logical Nodes being removed under /dev/dsk/ and /dev/rdsk:
c1t0d0s0
c1t0d0s1
c1t0d0s2
c1t0d0s3
c1t0d0s4
c1t0d0s5
c1t0d0s6
c1t0d0s7
********************************************************************************
注:这里之所以加个-F 参数,是因为从eeprom的输出结果中看出,此时系统上记录的启动盘仍然是0号盘(Nvram中存储的,而非实际),所以一旦从逻辑上剔出0号盘时,系统会有提示要求强制 剔除 提示如下:
WARNING!!! Please ensure that no filesystems are mounted on these device(s).
All data on these devices should have been backed up.
The list of devices being used (either busy or reserved) by the host:
1: Device /dev/rdsk/c1t0d0s2
Please enter 's' or <CR> to Skip the "busy/reserved" device(s) or
'q' to Quit and run the subcommand with
-F (force) option. [Default: s]: s
*********************************************************************************
此时在0号槽位上插入73G的硬盘,并在系统里执行devfsadm识别该盘
root@xz_netman # devfsadm
root@xz_netman # format //按照1号盘的分区情况对0号盘进行分区,因为2块盘的大小比一样,所以只能手动分区 ,本次分区客户要求,6号分区50M左右,swap 8G, 剩下的空间全部留给/ ,所以分区时从6号分区开始。
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c1t0d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
/pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000014c33883a9,0
1. c1t1d0 <SUN36G cyl 24620 alt 2 hd 27 sec 107>
/pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000004cfc333ff,0
Specify disk (enter its number): 0
selecting c1t0d0
[disk formatted]
AVAILABLE DISK SELECTIONS:
0. c1t0d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
/pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000014c33883a9,0
1. c1t1d0 <SUN36G cyl 24620 alt 2 hd 27 sec 107>
/pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000004cfc333ff,0
Specify disk (enter its number): 0
selecting c1t0d0
[disk formatted]
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
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
!<cmd> - execute <cmd>, 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
!<cmd> - execute <cmd>, then return
quit
partition> p
Current partition table (original):
Total disk cylinders available: 14087 + 2 (reserved cylinders)
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
partition> 6
Part Tag Flag Cylinders Size Blocks
6 usr wm 52 - 14086 68.10GB (14035/0/0) 142820160
Enter partition id tag[usr]: unassigned //因为6号分区作Metadb所以不用其分区名字
Enter partition permission flags[wm]: //回车,执行默认的WM 权限
Enter new starting cyl[52]: 14076
*******************************************************************************
注:
从上面的输出可以看出,总的柱面数是14086个,总大小为68.35G,则可以算出每个柱面大概有5M左右,则如果想给6号分区分大约50M的空间,则分配给6号分区10个左右的柱面就可以了,而6号分区的结束柱面为14086,则开始柱面选14076就可以满足需要。
*******************************************************************************
Enter partition size[111936b, 11c, 54.66mb, 0.05gb]:
//当输入起始柱面后,系统会自动算出该分区的大小,此时按回车确认默认的大小即可。
partition> l //lable,保存对该分区的设置
Ready to label disk, continue? y
partition> 6 //查看分区是否成功
Part Tag Flag Cylinders Size Blocks
6 unassigned wm 14076 - 14086 54.66MB (11/0/0) 111936
*****************************************************************************
注:
1. 其实,采用这种分区如果想达到比较精确的分区空间,我们可以采取下面的方法,比如我们想要给6号分区分50M的空间,那在估算出每个柱面的大小后(大约5M左右),先尝试把6号分区的起始柱面设为14076(大概是10个柱面的空间),则我们会在下一步中看到此时的6号分区的空间(54.66mb),发现比我们想要的空间要大了4m,则我们在下一步不保存当前设置即可(不输入label),之后重新对6号分区进行设置,把其实柱面在增大一个如:1477,再观察此时6号分区的大小,如果合适则保存,如果不合适则继续更改起始柱面,经过几次的尝试就可以得到比较精确的空间了。当空间大小合适后,输入label 保存设置即可。
2. 另外,采用这种倒着分区(从6号分区开始分区)方式进行分区时,一定要计算好起始柱面,在这里经常犯的错误是“顺序颠倒”的错误,比如6号分区起始柱面为14076,由于计算疏忽1号分区的结束柱面确为14078,这样就会出现柱面交叉,不过如果是单盘,即使出现柱面交叉,系统也不会抱错,但如果要作镜像,那么在建立子镜像和设立metadb时都回报错,具体情况会在附录中详细介绍
***********************************************************************
partition> 1
Part Tag Flag Cylinders Size Blocks
1 swap wu 26 - 51 129.19MB (26/0/0) 264576
Enter partition id tag[swap]: //回车,采取默认即可
Enter partition permission flags[wu]: //回车,采取默认即可
Enter new starting cyl[26]: 12427 //因为6号分区的起始柱面为14076,而7号,5号,3号和4号分区的空间又为0,所以1号分区的结束柱面为14075(而非14077,此处一定注意不要犯“颠倒顺序”的错误)而1号分区要8G的空间,大概就是1648个柱面,则1号分区的起始柱面该是12427。
Enter partition size[16780224b, 1649c, 8193.47mb, 8.00gb]:
//空间大小差不多,则按回车确认默认的空间大小即可
partition> l //保存
Ready to label disk, continue? y
根分区类似,这里不再详述。
root@xz_netman # format //确认分区
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c1t0d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
/pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000014c33883a9,0
1. c1t1d0 <SUN36G cyl 24620 alt 2 hd 27 sec 107>
/pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000004cfc333ff,0
Specify disk (enter its number): 0
selecting c1t0d0
[disk formatted]
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
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
!<cmd> - execute <cmd>, 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
!<cmd> - execute <cmd>, then return
quit
partition> p
Current partition table (original):
Total disk cylinders available: 14087 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 root wm 0 - 12426 60.30GB (12427/0/0) 126457152
1 swap wu 12427 - 14075 8.00GB (1649/0/0) 16780224
2 backup wu 0 - 14086 68.35GB (14087/0/0) 143349312
3 unassigned wu 0 0 (0/0/0) 0
4 unassigned wu 0 0 (0/0/0) 0
5 unassigned wu 0 0 (0/0/0) 0
6 unassigned wm 14076 - 14086 54.66MB (11/0/0) 111936
7 unassigned wu 0 0 (0/0/0) 0 |
|