资源

使用Clonezilla备份centos7整个磁盘

2019-06-01  本文已影响0人  dshowing

整体思路是制作再生龙的live设备(U盘、光驱),然后引导并备份系统,此外还需要一个外置磁盘用来存储备份文件,所以一共需要两个移动存储:live盘、备份文件存储盘。

网上说要备份的主机磁盘一定要比外置磁盘空间小,我这次使用了500G的磁盘,备份主机是一块128G的SSD,后来发现备份文件不到10G;因此说明备份文件的大小完全看系统内容有多少,如果系统比较纯净的话,完全可以使用一个U盘来存储,或者直接使用live盘(提前创建一个备份目录就可)

制作live

参考社区里的方法,我们使用zip文件在linux虚拟机下制作

下载

使用zip文件制作,官网下载,使用虚拟机挂载U盘,解压文件到U盘根目录(U盘提前格式化)

U盘格式化为FAT32格式,并记下盘符

root@dshowing-virtual-machine:~# fdisk -l /dev/sdb
Disk /dev/sdb:58.6 GiB,62914560000 字节,122880000 个扇区
单元:扇区 / 1 * 512 = 512 字节
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0xcad4ebea

设备       启动 起点      末尾      扇区  大小 Id 类型
/dev/sdb4  *     256 122879999 122879744 58.6G  c W95 FAT32 (LBA)
root@dshowing-virtual-machine:~# mkfs.vfat -F 32 /dev/sdb1

解压到U盘

root@dshowing-virtual-machine:~# unzip clonezilla-live-2.6.1-25-amd64.zip -d /media/dshowing/Ubuntu-Serv/

进入目录,制行脚本

root@dshowing-virtual-machine:~# cd /media/dshowing/Ubuntu-Serv/
root@dshowing-virtual-machine:/media/dshowing/Ubuntu-Serv# ls
boot  Clonezilla-Live-Version  EFI  GPL  home  live  syslinux  utils
root@dshowing-virtual-machine:/media/dshowing/Ubuntu-Serv# cd utils/linux/
root@dshowing-virtual-machine:/media/dshowing/Ubuntu-Serv/utils/linux# ls
extlinux  makeboot.sh  syslinux  VERSION.txt
root@dshowing-virtual-machine:/media/dshowing/Ubuntu-Serv/utils/linux# bash makeboot.sh /dev/sdb4
This command will install MBR and syslinux/extlinux bootloader on /dev/sdb
Clonezilla files are assumed to be on /dev/sdb4
--------------------------------------------
Machine: VMware Virtual Platform:
Model: Teclast CoolFlash USB3.0 (scsi)
Disk /dev/sdb: 62.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start  End     Size    Type     File system  Flags
 4      131kB  62.9GB  62.9GB  primary  fat32        boot, lba

--------------------------------------------
Are you sure you want to continue?
[y/n] y
OK! Let's do it!
--------------------------------------------
File system of /dev/sdb4: vfat
--------------------------------------------
Do you want to install MBR on /dev/sdb on this machine "VMware Virtual Platform" ?
[y/n] y
OK! Let's do it!
Running: cat "/media/dshowing/Ubuntu-Serv/utils/mbr/mbr.bin" > /dev/sdb
--------------------------------------------
Do you want to install the syslinux boot files on /dev/sdb4 on this machine "VMware Virtual Platform" ?
[y/n] y
OK! Let's do it!
A filesystem supporting Unix file mode for syslinux is required. Copying syslinux to /tmp/linux_tmp.IDvsKJ
'/media/dshowing/Ubuntu-Serv/utils/linux/syslinux' -> '/tmp/linux_tmp.IDvsKJ/syslinux'
On x86-64 system, you should install libc6-i386 (for Debian/Ubuntu) or glibc.i686 (for Fedora/CentOS/OpenSuSE) package so that the required libraries to run 32-bit program /tmp/linux_tmp.IDvsKJ/syslinux exist.
Program terminated!
root@dshowing-virtual-machine:/media/dshowing/Ubuntu-Serv/utils/linux# apt install glibc

遇到报错,上边提醒了,并告知需要安装的依赖,接下来解决依赖,重新执行

root@dshowing-virtual-machine:/media/dshowing/Ubuntu-Serv/utils/linux# apt install libc6-i386
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
下列软件包是自动安装的并且现在不需要了:
  libexpat1-dev libpython-all-dev libpython-dev libpython2.7-dev python-all python-all-dev python-asn1crypto python-cffi-backend python-cryptography python-dbus
  python-dev python-enum34 python-gi python-idna python-ipaddress python-keyring python-keyrings.alt python-pip-whl python-pkg-resources python-secretstorage
  python-setuptools python-six python-wheel python-xdg python2.7-dev
使用'sudo apt autoremove'来卸载它(它们)。
下列【新】软件包将被安装:
  libc6-i386
升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 350 个软件包未被升级。
需要下载 2,651 kB 的归档。
解压缩后会消耗 12.4 MB 的额外空间。
获取:1 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 libc6-i386 amd64 2.27-3ubuntu1 [2,651 kB]
已下载 2,651 kB,耗时 15秒 (175 kB/s)                                                                                                                                     
正在选中未选择的软件包 libc6-i386。
(正在读取数据库 ... 系统当前共安装有 180616 个文件和目录。)
正准备解包 .../libc6-i386_2.27-3ubuntu1_amd64.deb  ...
正在解包 libc6-i386 (2.27-3ubuntu1) ...
正在设置 libc6-i386 (2.27-3ubuntu1) ...
正在处理用于 libc-bin (2.27-3ubuntu1) 的触发器 ...
root@dshowing-virtual-machine:/media/dshowing/Ubuntu-Serv/utils/linux# bash makeboot.sh /dev/sdb4
This command will install MBR and syslinux/extlinux bootloader on /dev/sdb
Clonezilla files are assumed to be on /dev/sdb4
--------------------------------------------
Machine: VMware Virtual Platform:
Model: Teclast CoolFlash USB3.0 (scsi)
Disk /dev/sdb: 62.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start  End     Size    Type     File system  Flags
 4      131kB  62.9GB  62.9GB  primary  fat32        boot, lba

--------------------------------------------
Are you sure you want to continue?
[y/n] y
OK! Let's do it!
--------------------------------------------
File system of /dev/sdb4: vfat
--------------------------------------------
Do you want to install MBR on /dev/sdb on this machine "VMware Virtual Platform" ?
[y/n] y
OK! Let's do it!
Running: cat "/media/dshowing/Ubuntu-Serv/utils/mbr/mbr.bin" > /dev/sdb
--------------------------------------------
Do you want to install the syslinux boot files on /dev/sdb4 on this machine "VMware Virtual Platform" ?
[y/n] y
OK! Let's do it!
A filesystem supporting Unix file mode for syslinux is required. Copying syslinux to /tmp/linux_tmp.KQufJY
'/media/dshowing/Ubuntu-Serv/utils/linux/syslinux' -> '/tmp/linux_tmp.KQufJY/syslinux'
Running: "/tmp/linux_tmp.KQufJY/syslinux" -d syslinux -f -i "/dev/sdb4"
//NOTE// If your USB flash drive fails to boot (maybe buggy BIOS), try to use "syslinux -d syslinux -fs /dev/sdb4", i.e. running with "-fs".
syslinux ran successfully in installation mode.
Done!
root@dshowing-virtual-machine:/media/dshowing/Ubuntu-Serv/utils/linux# 

至此live制作完成

备份系统

关机插入U盘,开机进入BIOS,从U盘引导系统进入再生龙,中途备份的时候需要再次插入备份磁盘(移动硬盘),具体步骤请见CentOS 7系统上制作Clonezilla(再生龙)启动U盘并克隆双系统利用clonezilla克隆、还原CentOS整个系统

还原系统

还原过程与备份类似,选择[恢复系统用镜像文件到磁盘]即可

以上是对一次操作的简要记录,如有问题,欢迎探讨斧正

上一篇下一篇

猜你喜欢

热点阅读