RAID1试验

---路亚南制作

试验要求:两块磁盘做raid1

破坏其中一个硬盘(做删除操作)

恢复破坏的磁盘及数据

实现过程:1.准备linux,配置IP,链接putty

2.查看系统信息

[root@localhost~]# uname -a

Linuxlocalhost.localdomain 2.6.32-358.el6.x86_64 #1 SMP Tue Jan 29 11:47:41 EST 2013x86_64 x86_64 x86_64 GNU/Linux3.选择两块30G硬盘

4.重启

[root@localhost~]# reboot

5.浏览硬盘

[root@localhost~]# fdisk –l

········下面出现新的硬盘信息

Disk /dev/sdb:32.2 GB, 32212254720 bytes

255 heads, 63sectors/track, 3916 cylinders

Units =cylinders of 16065 * 512 = 8225280 bytes

Sector size(logical/physical): 512 bytes / 512 bytes

I/O size(minimum/optimal): 512 bytes / 512 bytes

Diskidentifier: 0x00000000

Disk /dev/sdc:32.2 GB, 32212254720 bytes

255 heads, 63sectors/track, 3916 cylinders

Units =cylinders of 16065 * 512 = 8225280 bytes

Sector size(logical/physical): 512 bytes / 512 bytes

I/O size(minimum/optimal): 512 bytes / 512 bytes

Diskidentifier: 0x00000000

6.建立分区b   c

[root@localhost~]# fdisk /dev/sdb

Command (m forhelp): n

Command action

e  extended

p  primary partition (1-4)

p

Partitionnumber (1-4): 1

First cylinder(1-3916, default 1):

Using defaultvalue 1

Last cylinder,+cylinders or +size{K,M,G} (1-3916, default 3916):

Using defaultvalue 3916

Command (m forhelp): t

Selectedpartition 1

Hex code (typeL to list codes): fd

Changed systemtype of partition 1 to fd (Linux raid autodetect)

Command (m forhelp): w

The partitiontable has been altered!

Callingioctl() to re-read partition table.

Syncing disks.

建立c分区同上

7.查看sdb1  sdc

[root@localhost~]# fdisk -l /dev/sdb

Disk /dev/sdb:32.2 GB, 32212254720 bytes

255 heads, 63sectors/track, 3916 cylinders

Units =cylinders of 16065 * 512 = 8225280 bytes

Sector size(logical/physical): 512 bytes / 512 bytes

I/O size(minimum/optimal): 512 bytes / 512 bytes

Diskidentifier: 0xaf9deeac

Device Boot      Start        End      Blocks  Id  System

/dev/sdb1               1        3916   31455238+  fd  Linux raid autodetect

[root@localhost~]# fdisk -l /dev/sdc

Disk /dev/sdc:32.2 GB, 32212254720 bytes

255 heads, 63sectors/track, 3916 cylinders

Units =cylinders of 16065 * 512 = 8225280 bytes

Sector size(logical/physical): 512 bytes / 512 bytes

I/O size(minimum/optimal): 512 bytes / 512 bytes

Diskidentifier: 0x8f842ede

Device Boot      Start         End      Blocks  Id  System

/dev/sdc1               1        3916   31455238+  fd  Linux raid autodetect

8.建立RAID1

[root@localhost~]# mdadm -C /dev/md0 -l 1 -n 2 /dev/sd[bc]1

mdadm: Note:this array has metadata at the start and

may not be suitable as a boot device.  If you plan to

store '/boot' on this device please ensurethat

your boot-loader understands md/v1.xmetadata, or use

--metadata=0.90

Continuecreating array? yes

mdadm:Defaulting to version 1.2 metadata

mdadm: array/dev/md0 started.

9.格式化该磁盘阵列

[root@localhost~]# mkfs.ext4 /dev/md0

10.创建data目录

[root@localhost~]# mkdir /data

11.挂载阵列到data目录下

[root@localhost~]# mount /dev/md0 /data

12.查看

[root@localhost~]# ll /data/

total 16

drwx------. 2root root 16384 Aug 15 04:36 lost+found

13.保存分区内容

[root@localhost~]# vi /etc/fstab

14.扫描系统阵列

[root@localhost~]# mdadm -Ds

ARRAY /dev/md0metadata=1.2 name=localhost.localdomain:0UUID=78520035:25e976fe:7411d793:5962601a

15.写入到配置文件

[root@localhost~]# mdadm -Ds >> /etc/mdadm.conf

16.重启查看

[root@localhost~]# reboot

17.查看挂载点

[root@localhost~]# mount

/dev/mapper/VolGroup-lv_rooton / type ext4 (rw)

proc on /proctype proc (rw)

sysfs on /systype sysfs (rw)

devpts on/dev/pts type devpts (rw,gid=5,mode=620)

tmpfs on/dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")

/dev/sda1 on/boot type ext4 (rw)

/dev/md0 on/data type ext4 (rw)

none on/proc/sys/fs/binfmt_misc type binfmt_misc (rw)

18.查看mdstat内容

[root@localhost~]# cat /proc/mdstat

Personalities: [raid1]

md0 : activeraid1 sdc1[1] sdb1[0]

31438720 blocks super 1.2 [2/2] [UU]

unuseddevices:

19.将其中一块30GB Linux6 64 标准模板的克隆-4.vmdkK删除。

20.重启后查看被删除的分区

[root@localhost~]# fdisk -l

Disk /dev/sda:21.5 GB, 21474836480 bytes

255 heads, 63sectors/track, 2610 cylinders

Units =cylinders of 16065 * 512 = 8225280 bytes

Sector size(logical/physical): 512 bytes / 512 bytes

I/O size(minimum/optimal): 512 bytes / 512 bytes

Diskidentifier: 0x0004106c

Device Boot      Start         End      Blocks  Id  System

/dev/sda1   *          1          64      512000  83  Linux

Partition 1does not end on cylinder boundary.

/dev/sda2              64        2611   20458496   8e  Linux LVM

Disk /dev/sdb:32.2 GB, 32212254720 bytes

255 heads, 63sectors/track, 3916 cylinders

Units =cylinders of 16065 * 512 = 8225280 bytes

Sector size(logical/physical): 512 bytes / 512 bytes

I/O size(minimum/optimal): 512 bytes / 512 bytes

Diskidentifier: 0xaf9deeac

Device Boot      Start         End      Blocks  Id  System

/dev/sdb1               1        3916   31455238+  fd  Linux raid autodetect

Disk /dev/sdc:32.2 GB, 32212254720 bytes

255 heads, 63sectors/track, 3916 cylinders

Units =cylinders of 16065 * 512 = 8225280 bytes

Sector size(logical/physical): 512 bytes / 512 bytes

I/O size(minimum/optimal): 512 bytes / 512 bytes

Diskidentifier: 0x00000000

Disk/dev/mapper/VolGroup-lv_root: 16.8 GB, 16752050176 bytes

255 heads, 63sectors/track, 2036 cylinders

Units =cylinders of 16065 * 512 = 8225280 bytes

Sector size(logical/physical): 512 bytes / 512 bytes

I/O size(minimum/optimal): 512 bytes / 512 bytes

Diskidentifier: 0x00000000

Disk/dev/mapper/VolGroup-lv_swap: 4194 MB, 4194304000 bytes

255 heads, 63sectors/track, 509 cylinders

Units =cylinders of 16065 * 512 = 8225280 bytes

Sector size(logical/physical): 512 bytes / 512 bytes

I/O size(minimum/optimal): 512 bytes / 512 bytes

Diskidentifier: 0x00000000

Disk /dev/md0:32.2 GB, 32193249280 bytes

2 heads, 4sectors/track, 7859680 cylinders

Units =cylinders of 8 * 512 = 4096 bytes

Sector size(logical/physical): 512 bytes / 512 bytes

I/O size(minimum/optimal): 512 bytes / 512 bytes

Diskidentifier: 0x00000000

21.raid1重建

模拟恢复,还是添加30GB的硬盘,重复6建立删除的分区c

[root@localhost~]# mdadm /dev/md0 -a /dev/sdc1

mdadm: added/dev/sdc1

22.查看日志

linux下raid1数据恢复,在linux下做RAID1试验相关推荐

  1. Linux服务器如何做raid1,Linux下制作raid1

    制作raid1 raid1是Linux服务器最常用的一种硬盘冗余备份的方案,它能在硬盘损坏的情况下保证硬盘数据内的安全.需要至少两块硬盘,最好是完全相同的两块硬盘,所创建的若磁盘中有谁损坏,则备用盘自 ...

  2. Linux下搭建ISCSI存储并用WindowsServer做FTP共享

    文章目录 前言 什么是前端? 什么是后端? 什么是全栈? 实验准备(以下实验都在VMware中进行) 一.Linux主机上 1.配置yum软件仓库 2.安装 iSCSI服务端程序 3.配置 iSCSI ...

  3. linux下c语言俄罗斯方块,c语言做俄罗斯方块

    我来对这段程序做一下注释: #include /*标准库*/ #include /*绘图库*/ #include /*BIOS库,输入输出,BIOS时间等*/ #define mDRAW 5 /*各种 ...

  4. Windows 和 Linux 应用程序从上到下调用层次比较

    刚毕业的时候,做了将近一年的Window下的程序开发,主要用MFC,那是也不明白程序在操作系统角度从上到下的整个调用层次.遇到调用库函数,不明白,就查MSDN,每个月1500行代码左右,那时以为这就是 ...

  5. windows命令行下访问linux,Windows支持直接访问Linux子系统文件:你的下一台Linux何必是Linux...

    原标题:Windows支持直接访问Linux子系统文件:你的下一台Linux何必是Linux 晓查 发自 凹非寺 量子位 报道 | 公众号 QbitAI 微软,致力于做最好的Linux发行版. 今天, ...

  6. linux交换分区的目录,linux 下的交换分区及根目录

    linux下的分区情况 Linux下的交换分区 Linux系统中的Linux交换分区是当物理内存(RAM)被充满时,作为物理内存的缓存来使用.当系统需要更多的内存资源,而物理内存已经充满,内存中不活跃 ...

  7. Windows下通过VNC远程访问Linux服务器,并实现可视化

    前言 最近因部门需要,老大想让我在公司Linux服务器上弄个Oracle,以用作部门测试环境的数据库服务器,经过一番折腾后,成功完成了任务.因公司Linux服务器是无图形界面的,本人接触Linux不多 ...

  8. linux 程序定时重启tomcat,linux下实现tomcat定时自动重启

    tomcat自带的脚本中没有提供直接restart的模式,但是有start和shutdown两种模式.要实现restart模式,实际上只需要判断是否已经启动tomcat,若已经启动则限制性shutdo ...

  9. [转帖]linux下的X server:linux图形界面原理

    linux下的X server:linux图形界面原理 https://www.cnblogs.com/liangxiaofeng/p/5034912.html linux下的X server:lin ...

最新文章

  1. python label怎么用_python tkinter label标签怎么使用?
  2. rt linux 测试,rtlinux 的配置和测试
  3. 十大编程算法助程序员走上高手之路
  4. JavaSE(十五)——注解
  5. 【转】TcpListener和tcpclient使用
  6. python伪造请求头x-forwarded-for的作用_Pyspider中给爬虫伪造随机请求头的实例
  7. 95-140-124-源码-transform-算子fold
  8. 需要编写支持英特尔 x86 的 Android* 游戏应用? 此处的样本可为您提供帮助!
  9. 计算机终止程序按钮,怎样在VisualBasic中终止计算机系统呢?
  10. 150330之软件测试
  11. python pyqt5教程pdf_PyQt5中文手册
  12. 有感 Visual Studio 2015 RTM 简介 - 八年后回归 Dot Net,终于迎来了 Mvc 时代,盼走了 Web 窗体时代
  13. 【EJB】Developing EJB Applications -- Chapter 2(创建企业级Bean项目)
  14. html记忆游戏,html5 最强大脑最强记忆游戏
  15. 敲笨钟 分数 20作者 陈越单位 浙江大学
  16. phpstudy运行时显示3306端口被占用
  17. 2016年,上海的互联网企业是否值得加入?
  18. HorizontalScrollview+recycleview实现横向滑动
  19. 英国脱欧给云计算行业带来震动:六大典型场景解析
  20. c# 节点导纳矩阵形成

热门文章

  1. 生日悖论问题——《算法导论学习笔记》
  2. 144.如何评价个性化推荐系统的效果-1
  3. 基于FPGA的PCIe接口实现(具体讲解了数据流向)
  4. BQB PTS dongle不识别问题
  5. 程序员向 GitHub 仓库提交 PR,结果 “轰炸” 了近 40 万开发者
  6. JQuery中$是什么?
  7. 2023ACP世界大赛-AI时代下,艺术教育者论坛
  8. spark.read.option参数
  9. 建筑行业转型升级,效果只有亿点
  10. D咚买菜抢购autojs核心代码分享