实验:一、破坏64位分区表,将其恢复,二、搭建HTTP服务

一:1、[root@xiqukeke ~]# hexdump -C -n 512 /dev/sda
00000000 eb 63 90 10 8e d0 bc 00 b0 b8 00 00 8e d8 8e c0 |.c..............|
00000010 fb be 00 7c bf 00 06 b9 00 02 f3 a4 ea 21 06 00 |...|.........!..|
00000020 00 be be 07 38 04 75 0b 83 c6 10 81 fe fe 07 75 |....8.u........u|
00000030 f3 eb 16 b4 02 b0 01 bb 00 7c b2 80 8a 74 01 8b |.........|...t..|
00000040 4c 02 cd 13 ea 00 7c 00 00 eb fe 00 00 00 00 00 |L.....|.........|
00000050 00 00 00 00 00 00 00 00 00 00 00 80 01 00 00 00 |................|
00000060 00 00 00 00 ff fa 90 90 f6 c2 80 74 05 f6 c2 70 |...........t...p|
00000070 74 02 b2 80 ea 79 7c 00 00 31 c0 8e d8 8e d0 bc |t....y|..1......|
00000080 00 20 fb a0 64 7c 3c ff 74 02 88 c2 52 be 05 7c |. ..d|<.t...R..||
00000090 b4 41 bb aa 55 cd 13 5a 52 72 3d 81 fb 55 aa 75 |.A..U..ZRr=..U.u|
000000a0 37 83 e1 01 74 32 31 c0 89 44 04 40 88 44 ff 89 |7...t21..D.@.D..|
000000b0 44 02 c7 04 10 00 66 8b 1e 5c 7c 66 89 5c 08 66 |D.....f..|f..f|
000000c0 8b 1e 60 7c 66 89 5c 0c c7 44 06 00 70 b4 42 cd |..|f.\..D..p.B.|<br/>000000d0 13 72 05 bb 00 70 eb 76 b4 08 cd 13 73 0d 5a 84 |.r...p.v....s.Z.|<br/>000000e0 d2 0f 83 de 00 be 85 7d e9 82 00 66 0f b6 c6 88 |.......}...f....|<br/>000000f0 64 ff 40 66 89 44 04 0f b6 d1 c1 e2 02 88 e8 88 |d.@f.D..........|<br/>00000100 f4 40 89 44 08 0f b6 c2 c0 e8 02 66 89 04 66 a1 |.@.D.......f..f.|<br/>00000110 60 7c 66 09 c0 75 4e 66 a1 5c 7c 66 31 d2 66 f7 ||f..uNf.|f1.f.|
00000120 34 88 d1 31 d2 66 f7 74 04 3b 44 08 7d 37 fe c1 |4..1.f.t.;D.}7..|
00000130 88 c5 30 c0 c1 e8 02 08 c1 88 d0 5a 88 c6 bb 00 |..0........Z....|
00000140 70 8e c3 31 db b8 01 02 cd 13 72 1e 8c c3 60 1e |p..1......r....|<br/>00000150 b9 00 01 8e db 31 f6 bf 00 80 8e c6 fc f3 a5 1f |.....1..........|<br/>00000160 61 ff 26 5a 7c be 80 7d eb 03 be 8f 7d e8 34 00 |a.&Z|..}....}.4.|<br/>00000170 be 94 7d e8 2e 00 cd 18 eb fe 47 52 55 42 20 00 |..}.......GRUB .|<br/>00000180 47 65 6f 6d 00 48 61 72 64 20 44 69 73 6b 00 52 |Geom.Hard Disk.R|<br/>00000190 65 61 64 00 20 45 72 72 6f 72 0d 0a 00 bb 01 00 |ead. Error......|<br/>000001a0 b4 0e cd 10 ac 3c 00 75 f4 c3 00 00 00 00 00 00 |.....&lt;.u........|<br/>000001b0 00 00 00 00 00 00 00 00 bb 72 0d 00 00 00 80 20 |.........r..... |<br/>000001c0 21 00 83 aa 28 82 00 08 00 00 00 00 20 00 00 aa |!...(....... ...|<br/>000001d0 29 82 83 fe ff ff 00 08 20 00 00 00 40 06 00 fe |)....... ...@...|<br/>000001e0 ff ff 82 fe ff ff 00 08 60 06 00 00 40 00 00 fe |...........@...|
000001f0 ff ff 05 fe ff ff 00 08 a0 06 00 f8 5f 12 55 aa |............_.U.|
00000200
2、[root@xiqukeke ~]# dd if=/dev/sda of=/data/mbr bs=1 count=512
512+0 records in
512+0 records out
512 bytes (512 B) copied, 0.00858063 s, 59.7 kB/s
3、[root@xiqukeke ~]# hexdump -C -n 512 /dev/sda
00000000 eb 63 90 10 8e d0 bc 00 b0 b8 00 00 8e d8 8e c0 |.c..............|
00000010 fb be 00 7c bf 00 06 b9 00 02 f3 a4 ea 21 06 00 |...|.........!..|
00000020 00 be be 07 38 04 75 0b 83 c6 10 81 fe fe 07 75 |....8.u........u|
00000030 f3 eb 16 b4 02 b0 01 bb 00 7c b2 80 8a 74 01 8b |.........|...t..|
00000040 4c 02 cd 13 ea 00 7c 00 00 eb fe 00 00 00 00 00 |L.....|.........|
00000050 00 00 00 00 00 00 00 00 00 00 00 80 01 00 00 00 |................|
00000060 00 00 00 00 ff fa 90 90 f6 c2 80 74 05 f6 c2 70 |...........t...p|
00000070 74 02 b2 80 ea 79 7c 00 00 31 c0 8e d8 8e d0 bc |t....y|..1......|
00000080 00 20 fb a0 64 7c 3c ff 74 02 88 c2 52 be 05 7c |. ..d|<.t...R..||
00000090 b4 41 bb aa 55 cd 13 5a 52 72 3d 81 fb 55 aa 75 |.A..U..ZRr=..U.u|
000000a0 37 83 e1 01 74 32 31 c0 89 44 04 40 88 44 ff 89 |7...t21..D.@.D..|
000000b0 44 02 c7 04 10 00 66 8b 1e 5c 7c 66 89 5c 08 66 |D.....f..|f..f|
000000c0 8b 1e 60 7c 66 89 5c 0c c7 44 06 00 70 b4 42 cd |..|f.\..D..p.B.|<br/>000000d0 13 72 05 bb 00 70 eb 76 b4 08 cd 13 73 0d 5a 84 |.r...p.v....s.Z.|<br/>000000e0 d2 0f 83 de 00 be 85 7d e9 82 00 66 0f b6 c6 88 |.......}...f....|<br/>000000f0 64 ff 40 66 89 44 04 0f b6 d1 c1 e2 02 88 e8 88 |d.@f.D..........|<br/>00000100 f4 40 89 44 08 0f b6 c2 c0 e8 02 66 89 04 66 a1 |.@.D.......f..f.|<br/>00000110 60 7c 66 09 c0 75 4e 66 a1 5c 7c 66 31 d2 66 f7 ||f..uNf.|f1.f.|
00000120 34 88 d1 31 d2 66 f7 74 04 3b 44 08 7d 37 fe c1 |4..1.f.t.;D.}7..|
00000130 88 c5 30 c0 c1 e8 02 08 c1 88 d0 5a 88 c6 bb 00 |..0........Z....|
00000140 70 8e c3 31 db b8 01 02 cd 13 72 1e 8c c3 60 1e |p..1......r....|<br/>00000150 b9 00 01 8e db 31 f6 bf 00 80 8e c6 fc f3 a5 1f |.....1..........|<br/>00000160 61 ff 26 5a 7c be 80 7d eb 03 be 8f 7d e8 34 00 |a.&Z|..}....}.4.|<br/>00000170 be 94 7d e8 2e 00 cd 18 eb fe 47 52 55 42 20 00 |..}.......GRUB .|<br/>00000180 47 65 6f 6d 00 48 61 72 64 20 44 69 73 6b 00 52 |Geom.Hard Disk.R|<br/>00000190 65 61 64 00 20 45 72 72 6f 72 0d 0a 00 bb 01 00 |ead. Error......|<br/>000001a0 b4 0e cd 10 ac 3c 00 75 f4 c3 00 00 00 00 00 00 |.....&lt;.u........|<br/>000001b0 00 00 00 00 00 00 00 00 bb 72 0d 00 00 00 80 20 |.........r..... |<br/>000001c0 21 00 83 aa 28 82 00 08 00 00 00 00 20 00 00 aa |!...(....... ...|<br/>000001d0 29 82 83 fe ff ff 00 08 20 00 00 00 40 06 00 fe |)....... ...@...|<br/>000001e0 ff ff 82 fe ff ff 00 08 60 06 00 00 40 00 00 fe |...........@...|
000001f0 ff ff 05 fe ff ff 00 08 a0 06 00 f8 5f 12 55 aa |............_.U.|
00000200
[root@xiqukeke ~]# ll /data/mbr
-rw-r--r-- 1 root root 512 Feb 10 22:15 /data/mbr
4、将数据拷贝走
[root@xiqukeke ~]# scp /data/mbr 192.168.141.130:/data
root@192.168.141.130's password:
mbr 100% 512 464.9KB/s 00:00
5、[root@xiqukeke ~]# dd if=/dev/zero of=/dev/sda bs=1 count=64 skip=446 seek=44664+0 records in
64+0 records out
64 bytes (64 B) copied, 0.000504458 s, 127 kB/s
[root@xiqukeke ~]# fdisk -l /dev/sda

Disk /dev/sda: 214.7 GB, 214748364800 bytes, 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000d72bb

Device Boot Start End Blocks Id System
6、reboot
7、进入救援模式,出现开机滚动条时,迅速按esc键,选择第三项:CD-ROM Drive,选择第三项:Troubleshooting,选择第二项:Rescue a CentOS system,当出现 Please make a selection from the above:【1】 出现 Please press <return> to get a shell时,按回车键,出现“ sh-4.2# ”,此时“ df ”发现无/sda,我们添加网络,centos7的ens33的ip192.168.141.254添加上,scp 192.168.141.130:/data/mbr .拷贝到当前目录下,ls --> 当前目录下有 mbr ,接着,dd if=mbr of=/dev/sda 即可还原分区表,exit后就能重新恢复数据,完成修复。
二、搭建HTTP服务
one、首先配置光盘yum源
1.将光盘推入,连接上主机
2.新建挂载点 mkdir /mnt/cdrom
3.挂载 A:临时挂载 mount /dev/cdrom /mnt/cdrom
或者 B:mount –t iso9660 –o ro /dev/cdrom /mnt/cdrom
[root@centos7 ~]# mkdir /mnt/cdrom
[root@centos7 ~]# mount /dev/cdrom /mnt/cdrom
mount: /dev/sr0 is write-protected, mounting read-only
two、配置本地yum源
1.进入yum源目录 cd /etc/yum.repos.d
2.把当前文件文件全部删除或移动到其他地方只保留一个文件 一般保留 CentOS-Media.repo ####(保险起见,我们复制到/data下一份,并把该文件下 CentOS-Media.repo 保留,其他均删除 )
[root@centos7 ~]# cd /etc/yum.repos.d
[root@centos7 yum.repos.d]# ll
total 32
-rw-r--r--. 1 root root 1664 Nov 23 21:16 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 Nov 23 21:16 CentOS-CR.repo
-rw-r--r--. 1 root root 649 Nov 23 21:16 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 314 Nov 23 21:16 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 Nov 23 21:16 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 Nov 23 21:16 CentOS-Sources.repo
-rw-r--r--. 1 root root 5701 Nov 23 21:16 CentOS-Vault.repo
如下是复制备份过程,可忽略不看:
[root@centos7 yum.repos.d]# cp -r /etc/yum.repos.d /data
[root@centos7 yum.repos.d]# cd /data
[root@centos7 data]# ll
total 0
drwxr-xr-x 2 root root 187 Feb 11 12:02 yum.repos.d
[root@centos7 yum.repos.d]# ll
total 4
-rw-r--r--. 1 root root 630 Nov 23 21:16 CentOS-Media.repo
3、[root@centos7 yum.repos.d]# vi CentOS-Media.repo

CentOS-Media.repo

#

This repo can be used with mounted DVD media, verify the mount point for

CentOS-7. You can use this repo and yum to install items directly off the

DVD ISO that we release.

#

To use this repo, put in your DVD and use it with the other repos too:

yum --enablerepo=c7-media [command]

#

or for ONLY the media repo, do this:

#

yum --disablerepo=* --enablerepo=c7-media [command]

[c7-media] :源名称id
name=CentOS-$releasever - Media :源的描述
baseurl=file:///mnt/cdrom/ 源的本地路径
gpgcheck=0 要不要做包的签名验证,0是不需要,1是需要
enabled=1 :1表示源是开启的
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 :不用在意
three、安装软件 yum install [软件名]
[root@centos7 yum.repos.d]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
c7-media | 3.6 kB 00:00
(1/2): c7-media/group_gz | 166 kB 00:00
(2/2): c7-media/primary_db | 6.0 MB 00:00
repo id repo name status
c7-media CentOS-7 - Media 10,019
repolist: 10,019
输入yum repolist,查看yum仓库配置报告正常,表示已经可以使用以安装光盘配置的yum仓库了,如上图。
root@centos7 yum.repos.d]# yum install httpd -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-88.el7.centos will be installed
Dependency Installed:
apr.x86_64 0:1.4.8-3.el7_4.1 apr-util.x86_64 0:1.5.2-6.el7
httpd-tools.x86_64 0:2.4.6-88.el7.centos mailcap.noarch 0:2.1.41-2.el7
Complete!
four、[root@centos7 yum.repos.d]# rpm -ql httpd
/etc/httpd
/etc/httpd/conf
/etc/httpd/conf.d
/etc/httpd/conf.d/README
/etc/httpd/conf.d/autoindex.conf
/etc/httpd/conf.d/userdir.conf
/etc/httpd/conf.d/welcome.conf
/etc/httpd/conf.modules.d
/etc/httpd/conf.modules.d/00-base.conf
/etc/httpd/conf.modules.d/00-dav.conf
/etc/httpd/conf.modules.d/00-lua.conf
/etc/httpd/conf.modules.d/00-mpm.conf
/etc/httpd/conf.modules.d/00-proxy.conf
/etc/httpd/conf.modules.d/00-systemd.conf
/etc/httpd/conf.modules.d/01-cgi.conf
/etc/httpd/conf/httpd.conf
/etc/httpd/conf/magic
查看该包生成了哪些文件及文件夹,内有/var/www/html 文件夹,
five、查看该文件夹,cd进去,该文件夹为空:
[root@centos7 yum.repos.d]# ll -d /var/www/html
drwxr-xr-x 2 root root 6 Nov 5 09:47 /var/www/html
[root@centos7 yum.repos.d]# cd /var/www/html
[root@centos7 html]#
将该文件启动起来:
[root@centos7 html]# systemctl start httpd
[root@centos7 html]#
six、创建一个文件夹:
[root@centos7 html]# mkdir -p centos/{7,6}/os/x86_64/
[root@centos7 html]# ll
total 0
drwxr-xr-x 4 root root 24 Feb 11 12:42 centos
挂载、[root@centos7 html]# mount /dev/sr0 centos/7/os/x86_64/
mount: /dev/sr0 is write-protected, mounting read-only
[root@centos7 html]# mount /dev/sr1 centos/6/os/x86_64/
mount: /dev/sr1 is write-protected, mounting read-only

转载于:https://blog.51cto.com/14128387/2349123

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值