Solaris10镜像情况下如何修复boot archive
在某些情况下(比如:异常宕机)solaris10的boot archive可能会损坏,导致solaris无法启动,此时需要手工修复boot archive。
本文通过模拟boot archive损坏,测试如何在root镜像存在的情况下恢复boot archive. (本测试在x86虚拟机上进行)
测试分为四部分。第一部分是solaris10做root镜像,第二部分通过dd命令模拟boot archive损坏,第三部分是拆除镜像和修复boot archive,第四部分是修复root镜像
1. 系统盘镜像
1) 硬盘分区情况
c1t0d0s0 /
c1t0d0s1 swap
c1t0d0s7 metadb
2) 镜像盘创建solaris fdisk分区 (x86)
format -> 1(镜像盘) -> fdisk -> y
3) 将源盘分区表同步到镜像盘上
root@solaris10 # prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2
fmthard: New volume table of contents now in place.
4) 创建metadb,放在slice7上
root@solaris10 # metadb -a -c 3 -f c1t0d0s7 c1t1d0s7
root@solaris10 # metadb -i
flags first blk block count
a u 16 8192 /dev/dsk/c1t0d0s7
a u 8208 8192 /dev/dsk/c1t0d0s7
a u 16400 8192 /dev/dsk/c1t0d0s7
a u 16 8192 /dev/dsk/c1t1d0s7
a u 8208 8192 /dev/dsk/c1t1d0s7
a u 16400 8192 /dev/dsk/c1t1d0s7
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
5) 创建root分区镜像
root@solaris10 # metainit -f d11 1 1 c1t0d0s0
d11: Concat/Stripe is setup
root@solaris10 # metainit -f d12 1 1 c1t1d0s0
d12: Concat/Stripe is setup
root@solaris10 # metainit d10 -m d11
d10: Mirror is setup
6) 执行metaroot修改vfstab
root@solaris10 # metaroot d10
7) 重启
root@solaris10 # shutdown -i6 -g0 -y
8) 创建swap镜像
root@solaris10 # metainit -f d21 1 1 c1t0d0s1
d21: Concat/Stripe is setup
root@solaris10 # metainit -f d22 1 1 c1t1d0s1
d22: Concat/Stripe is setup
root@solaris10 # metainit d20 -m d21
d20: Mirror is setup
9) 修改vfstab文件
/dev/dsk/c1t0d0s1 - - swap - no -
修改为=>
/dev/md/dsk/d20 - - swap - no -
10) 重启
root@solaris10 # shutdown -i6 -g0 -y
11) 附加子镜像
root@solaris10 # metattach d10 d12
d10: submirror d12 is attached
root@solaris10 # metattach d20 d22
d20: submirror d22 is attached
12) 检查镜像
root@solaris10 # metastat
2. 模拟boot archive损坏
root@solaris10 # dd if=/dev/zero of=/platform/`uname -i`/boot_archive bs=1024 count=1
1+0 records in
1+0 records out重启主机
root@solaris10 # shutdown -i6 -g0 –y报错:

3. 修复boot archive
1) 启动到failsafe
启动时选择Solaris failsafe (x86)
ok boot -F failsafe (sparc)
2) 拆除镜像
# mount /dev/dsk/c1t0d0s0 /a
备份vfstab
# cp /a/etc/vfstab /a/etc/vfstab.svm备份system
# cp /a/etc/system /a/etc/system.svm修改vfstab文件,把所有md设备修改成slice
# TERM=vt100; export TERM
# vi /a/etc/vfstab(如果不清楚md设备与slice的对应关系,可以cat /a/etc/lvm/md.cf)
如果vfstab与初始安装时一致,也可以用初始安装覆盖
# cp /a/etc/vfstab-INSTALL /a/etc/vfstab修改system文件,注释掉(或者删除)rootdev:/pseudo/md@0:0,10,blk这一行。
# vi /a/etc/system如果system与初始安装时一致,也可以用初始安装覆盖
# cp /a/etc/system-INSTALL /a/etc/system
3) 修复boot archive
删除boot archive
# rm -f /a/platform/`uname -i`/boot_archive重建boot archive
# bootadm update-archive -R /a重启
# shutdown -i6 -g0 –y
4. 修复镜像
1) detach子镜像
root@solaris10 # metadetach d10 d12
d10: submirror d12 is detached
root@solaris10 # metadetach d20 d22
d20: submirror d22 is detached
2) 恢复原来的vfstab和system文件
root@solaris10 # mv /etc/system.svm /etc/system
root@solaris10 # mv /etc/vfstab.svm /etc/vfstab
3) 重启
root@solaris10 # shutdown -i6 -g0 –y
4) attach子镜像
root@solaris10 # metattach d10 d12
d10: submirror d12 is attached
root@solaris10 # metattach d20 d22
d20: submirror d22 is attached
Solaris10镜像情况下如何修复boot archive的更多相关文章
- Solaris Tips: Repairing the Boot Archive (ZT)
http://www.seedsofgenius.net/solaris/solaris-tips-repairing-the-boot-archive 注意以下是系统盘非镜像情况下的操作,如果系统盘 ...
- Android热修复技术选型(不在市场发布新版本的情况下,直接更新app)
2015年以来,Android开发领域里对热修复技术的讨论和分享越来越多,同时也出现了一些不同的解决方案,如QQ空间补丁方案.阿里AndFix以及微信Tinker,它们在原理各有不同,适用场景各异,到 ...
- @Spring Boot程序员,我们一起给程序开个后门吧:让你在保留现场,服务不重启的情况下,执行我们的调试代码
前言 这篇其实是对一年前的一篇文章的补坑. @Java Web 程序员,我们一起给程序开个后门吧:让你在保留现场,服务不重启的情况下,执行我们的调试代码 当时,就是在spring mvc应用里定义一个 ...
- 解决spring boot在RabbitMQ堆积消息情况下无法启动问题
最近遇到一个问题,服务站点上线之前,先去新建需要的rabbitmq并绑定关系,此时 如果发送消息方运行, 那边会造成新建的q消息部分堆积得不到及时消费 那么问题来了? 在消息堆积情况下,服务站点无法启 ...
- 在不格式化原有系统盘的情况下,利用grub4dos+firadisk制作RamOS VHD Win7总结
在不格式化原有系统盘的情况下,利用grub4dos+firadisk制作RamOS VHD Win7总结在不格式化原有系统盘的情况下,用grub4dos+firadisk安装WIN7到VHD,内存大的 ...
- Oracle redo 日志损坏的几种情况下的恢复
Oracle redo 日志损坏的几种情况下的恢复 第一:损坏的redo为非正在使用的redo log 1.归档模式,不是当前正在日志损坏,数据库打开模式. 模拟损坏:SQL> select * ...
- Glusterfs冗余镜像(AFR)修复原理以及脑裂分析
研究Glusterfs半年多了,通过实际操作以及源代码分析,对它有了越来越深的了解,由衷的赞叹Gluster的整体架构.今天时间不早了,想写点关于Glusterfs的冗余镜像产生脑裂的原因. 首先,简 ...
- @Java Web 程序员,我们一起给程序开个后门吧:让你在保留现场,服务不重启的情况下,执行我们的调试代码
一.前言 这篇算是类加载器的实战第五篇,前面几篇在这里,后续会持续写这方面的一些东西. 实战分析Tomcat的类加载器结构(使用Eclipse MAT验证) 还是Tomcat,关于类加载器的趣味实验 ...
- php 502 无错误行和报错文件的情况下使用gdb调试方法
lnmp环境 gdb /usr/local/php5.2/bin/php-cgi /tmp/coredump-php-cgi.20503 source /home/tmp/lnmp1.4-full ...
随机推荐
- Kafka+SparkStreaming+Zookeeper(ZK存储Offset,解决checkpoint问题)
创建一个topic ./kafka-topics.sh --create --zookeeper 192.168.1.244:2181,192.168.1.245:2181,192.168.1.246 ...
- 排序算法(java版)
一直想理解一下基本的排序算法,最近正好在搞java所以就一并了(为了便于理解,这儿都是以从小到大排序为目的) 冒泡排序 也就是比较连续的两个值,如果前面一个值大于后面一个值,则交换. 时间复杂度为O( ...
- 手把手教你安装SSL证书升级https
是不是觉得别人网站前面的小绿锁很好看? 而且,Google官方也正式承认过https是影响搜索排名的一个因素,那么如何将自己的网站全面升级为https呢?今天的内容就介绍一下如何将部署在Nginx的W ...
- nodejs 中 excel-export 使用介绍
1. 为了在nodejs 服务器端操作数据导出excel 格式用的 excel-export 包地址:https://github.com/functionscope/Node-Excel-Expo ...
- mvn 用指定setting.xml 执行指定pom.xml
mvn package -f pom.xml -s setting.xml clean install
- Liberty版本更新日志中文版本
新功能 API · 为所有的endpoints默认使用v2.1的API,v2.0和v1.1使用了新的兼容模式,对已经使用API的用户过渡更平稳.( https://blueprints.launch ...
- 2017-03-05 CentOS中结合Nginx部署dotnet core Web应用程序
Visual Studio Live 倒计时2天,当然这是美国倒计时两天,中国应该是在3月8日的凌晨,正值"3.8妇女节".提前祝广大的女性同志节日快乐,当然还有奋斗在一线的程序媛 ...
- asp.net中异步调用webservice
WebService方法是不需要作任何修改的,只是在调用时采用异步的方式,这样在循环中,速度会显得快一点. 原来的方式: HotelMagWeb.com.china_sms.www.MainServi ...
- nohup+命令+& 【退出终端后,程序依然在后台运行】
[ 如果你正在运行一个进程,而且你觉得在退出帐户时该进程还不会结束,那么可以使用nohup命令. 该命令可以忽略所有挂断(SIGHUP)信号,在你退出帐户/关闭终端之后继续运行相应的进程. nohup ...
- 分布式_事务_01_2PC框架raincat快速体验1
一.前言 关于2PC的理论知识请见:分布式_理论_03_2PC 这一节我们来看下github上一个优秀的2PC分布式事务开源框架的快速体验. 二.源码 源码请见: https://github.com ...