美文网首页OpenMediaVault
OMV的备份恢复(2019-06-18)

OMV的备份恢复(2019-06-18)

作者: 龙天ivan | 来源:发表于2019-06-18 13:23 被阅读0次

前提说明:
旧的omv安装在了/dev/sda上,备份的时候只备份了/dev/sda1,由于mbr和grub那部分缺失,需要恢复的时候重建

一、tinycore Linux

Tiny Core Linux是一份很小(18 MB)的最低限度Linux桌面。它基于Linux 4.x内核、Busybox、Tiny X、FLTK图形用户界面、JWM窗口管理器,全部运行在内存中。它并非一份完整的桌面,也不完整支持所有的硬件;它只代表能引导进入一份最小X窗口桌面所需的核心内容,典型情况下可包含对有线网络的访问。这份最小桌面可以通过从在线软件仓库安装额外应用软件来进行扩展。

使用tinycore linux来重建,下载好tinycore后(下载64位的),加载tinycore启动,可以用图形界面,也可以用纯命令行,差别不大,因为所有操作都是命令。

二、新硬盘中分区

sudo -s进入root用户来操作

root@box:~ dd if=/dev/zero of=/dev/sda bs=100M    #清空硬盘分区表
root@bogon:~ fdisk /dev/sda

Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xde369dae.

Command (m for help): p
Disk /dev/sda: 4 GiB, 4294967296 bytes, 8388608 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
Disklabel type: dos
Disk identifier: 0xde369dae

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-8388607, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-8388607, default 8388607): 

Created a new partition 1 of type 'Linux' and of size 4 GiB.

Command (m for help): a
Selected partition 1
The bootable flag on partition 1 is enabled now.

Command (m for help): p
Disk /dev/sda: 4 GiB, 4294967296 bytes, 8388608 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
Disklabel type: dos
Disk identifier: 0xde369dae

Device     Boot Start     End Sectors Size Id Type
/dev/sda1  *     2048 8388607 8386560   4G 83 Linux

Command (m for help): w   
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

这样分区就好了,下面需要格式化硬盘:

root@box~: mkfs.ext4 -T largefile /dev/sda1
mke2fs 1.44.5 (15-Dec-2018)
Discarding device blocks: done                            
Creating filesystem with 1048320 4k blocks and 4096 inodes
Filesystem UUID: 82bdc768-b2ac-4bfd-a5d1-38b163e0abf6
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done 

三、恢复镜像文件

首先,需要把镜像文件挂载到机器上,可以访问,然后用dd命令写入/dev/sda1

root@box:/mnt/vda1:  dd if=./omv-bak.img of=/dev/sda1 bs=4M
1024+0 records in
1024+0 records out
4294967296 (4.0GB) copied, 87,718746 seconds, 46.7MB/s 

四、恢复引导

a. 用chroot进去配置

root@box:~: mount /dev/sda1 /mnt/sda1
root@box:~: mount -t proc /proc /mnt/sda1/proc
root@box:~: mount --rbind /dev /mnt/sda1/dev
root@box:~: mount --rbind /sys /mnt/sda1/sys
root@box:~: chroot /mnt/sda1 /bin/bash
root@box:~: source /etc/profile

b. 重新配置grub

root@box:~: grub-install /dev/sda   #这里的sda要根据实际情况,可以fdisk -l确认一下
root@box:~: update-grub2
root@box:~: grub-probe / 
root@box:~: update-initramfs -u -k all

#退出chroot
root@box:~: exit

五、重启

相关文章

  • OMV的备份恢复(2019-06-18)

    前提说明:旧的omv安装在了/dev/sda上,备份的时候只备份了/dev/sda1,由于mbr和grub那部分缺...

  • postgres备份

    | | 备份速度|备份范围|恢复范围|操作影响|备份原理|恢复成本|| ------- |:---...

  • mydumper备份数据库

    一、备份 1.全库备份 2.单库备份 3.表备份 二、恢复 恢复库 单表恢复 单表恢复需要解压备份文件为sql格式...

  • 备份恢复

    备份恢复 在备份恢复需要做哪些工作 设计备份策略 备份周期 天,周,月 备份方式 全备,增量.... 备份什么? ...

  • MySQL(六 数据备份,pymysql模块),数据库远程连接

    MySQL数据备份 一、mysqldump实现逻辑备份 二、恢复逻辑备份 三、备份/恢复案例 四、实现自动化备份 ...

  • mysqldump常用操作

    insert备份 insert恢复 txt备份 txt恢复 mysqldump常用参数 myisam物理备份 in...

  • 备份恢复

    备份恢复 1. 运维人员在备份恢复工作职责 a. 备份、恢复策略定制b. 备份巡检c. 定期恢复演练d. 出现数据...

  • GHOST备份与还原系统(图文)

    GHOST手动备份与还原系统 GHOST恢复: (恢复完毕) GHOST备份:

  • gitlab的备份

    gitlab的备份 添加 重新加载配置 手动备份 自动备份 恢复备份

  • 【MySQL】xtrabackup实战版

    备份脚本 全量备份脚本 增量备份脚本 全量恢复 增量恢复 全量备份脚本 增量备份脚本 目录结构 其中mysql_d...

网友评论

    本文标题:OMV的备份恢复(2019-06-18)

    本文链接:https://www.haomeiwen.com/subject/pmxfqctx.html