系统克隆工具-Clonezilla
2010-11-09 14:37:45 阿炯

Clonezilla(再生龙)是一个很好的系统克隆工具,它可以说是吸取了 Norton Ghost 和 Partition Image 的优点,是一个免费的灾难恢复、硬盘克隆、硬盘映像档制作的部署和解决方案。即不仅支持对整个系统进行克隆,而且也可以克隆单个的分区,这种灵活性可能更能适应备份者的需要。是基于Debian的自启动运行光盘,它保存并恢复硬盘上那些使用了的数据块,使用Clonezilla的用户可以在大约10分钟内将5GB的系统克隆到40台客户机上。主要由Shell与Perl脚本编写开发与整合,在GPLv2协议下授权使用。

Clonezilla, based on DRBL, Partclone and udpcast, allows you to do bare metal backup and recovery. Two types of Clonezilla are available, Clonezilla live and Clonezilla SE (server edition). Clonezilla live is suitable for single machine backup and restore. While Clonezilla SE is for massive deployment, it can clone many (40 plus!) computers simultaneously. Clonezilla saves and restores only used blocks in the harddisk. This increases the clone efficiency. At the NCHC's Classroom C, Clonezilla SE was used to clone 41 computers simultaneously. It took only about 10 minutes to clone a 5.6 GBytes system image to all 41 computers via multicasting!

Clonezilla Live 是一个小型的可启动 GNU/Linux 发行版,适用于基于 x86/amd64 的计算机。它可以使用 CD/DVD 或 USB 闪存对单个计算机进行镜像或克隆。其主要优势是不需要提前设置 DRBL 服务器,也不需要被部署的计算机从网络上启动。内置的备份与恢复工具 Partclone 是其内置的一个非常优秀工具,支持多种文件系统,包括 EXT2、EXT3、EXT4、ReiserFS、XFS、JFS、FAT、NTFS、HFS+、UFS、minix 和 VMFS。它还支持 LVM2、multicast 以及 32 位 (x86) 和 64 位 (x86_64) 架构,可用于克隆 GNU/Linux、macOS 和 Windows 系统。

功能
* 在 GNU/Linux 端所支持的文件系统包括:ext2、ext3、reiserfs、xfs、jfs;同时Clonezilla也支持 M$ Windows 上的 FAT、NTFS 文件系统。这意味着既可以使用 Clonezilla 克隆 GNU/Linux 系统,也能够对 M$ Windows 系统进行克隆。
* Clonezilla 支持使用 PXEBoot 来进行 Multicast 克隆。这对于需要克隆大量系统的用户极为有用。

Features
* Free (GPL) Software.
* Filesystem supported: (1) ext2, ext3, ext4, reiserfs, reiser4, xfs, jfs of GNU/Linux, (2) FAT, NTFS of MS Windows, (3) HFS+ of Mac OS, (4) UFS of FreeBSD, NetBSD, and OpenBSD, and (5) VMFS of VMWare ESX. Therefore you can clone GNU/Linux, MS windows, Intel-based Mac OS, and FreeBSD, NetBSD, and OpenBSD, no matter it's 32-bit (x86) or 64-bit (x86-64) OS. For these file systems, only used blocks in partition are saved and restored. For unsupported file system, sector-to-sector copy is done by dd in Clonezilla.
* LVM2 (LVM version 1 is not) under GNU/Linux is supported.
* Grub (version 1 and version 2) is supported.
* Multicast is supported in Clonezilla SE, which is suitable for massively clone. You can also remotely use it to save or restore a bunch of computers if PXE and Wake-on-LAN are supported in your clients.
* Based on Partclone (default), Partimage (optional), ntfsclone (optional), or dd to image or clone a partition. However, Clonezilla, containing some other programs, can save and restore not only partitions, but also a whole disk.
* By using another free software drbl-winroll, which is also developed by us, the hostname, group, and SID of cloned MS windows machine can be automatically changed.


2025年2月笔者用Clonezilla将一块500G的盘迁移至1T的盘上。完成后1T的盘的分区大小与500G相同,盘上有三个分区:/boot,swap,/。
好在文件系统格式为xfs的'/'在第三分区上,现需要将其扩展到整盘。记录如下:

# parted /dev/sda
GNU Parted 3.4
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                                
Model: ATA HGST HTS721010A9 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags:
Number  Start   End     Size    Type     File system     Flags
 1      1049kB  300MB   299MB   primary  xfs             boot
 2      300MB   5100MB  4800MB  primary  linux-swap(v1)
 3      5100MB  500GB   495GB   primary  xfs

(parted) unit GB
(parted) p
Model: ATA HGST HTS721010A9 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags:
Number  Start   End     Size    Type     File system     Flags
 1      0.00GB  0.30GB  0.30GB  primary  xfs             boot
 2      0.30GB  5.10GB  4.80GB  primary  linux-swap(v1)
 3      5.10GB  500GB   495GB   primary  xfs

(parted) resizepart 3 100%
Warning: Partition /dev/sda3 is being used. Are you sure you want to continue?
Yes/No? YES                                                               
(parted) P
Model: ATA HGST HTS721010A9 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags:
Number  Start   End     Size    Type     File system     Flags
 1      0.00GB  0.30GB  0.30GB  primary  xfs             boot
 2      0.30GB  5.10GB  4.80GB  primary  linux-swap(v1)
 3      5.10GB  1000GB  995GB   primary  xfs

# partx /dev/sda
NR   START        END    SECTORS   SIZE NAME UUID
 1    2048     585727     583680   285M      3b598411-01
 2  585728    9961471    9375744   4.5G      3b598411-02
 3 9961472 1953525167 1943563696 926.8G      3b598411-03

# xfs_growfs /
meta-data=/dev/sda3              isize=512    agcount=4, agsize=30212800 blks
 =                       sectsz=4096  attr=2, projid32bit=1
 =                       crc=1        finobt=1, sparse=1, rmapbt=0
 =                       reflink=1    bigtime=0
data     =                       bsize=4096   blocks=120851200, imaxpct=25
 =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=59009, version=2
 =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 120851200 to 242945462

验证成功,在系统上用'df'看到的分区大小如下:

# df -h
文件系统        容量  已用  可用 已用% 挂载点
/dev/sda3       927G  385G  542G   42% /

最新版本:2.4
该版本对在机器恢复分区做了一些 bug 修复,并支持 UEFI 和在克隆交换分区的磁盘上使用GPT布局。其它值得关注的更新内容如下:
The underlying GNU/Linux operating system was upgraded.
This release  is based on the Debian's 'Sid' repository as of 2015-06-08;
Linux kernel has been updated to 4.0.2;
the default Unionfs file system has been changed to overlay
更多内容请查看发行说明

最新版本:2.8
于2021年11月下旬发布的2.8版本在底层的 GNU/Linux 操作系统得到了升级,基于 Debian Sid 仓库。
Linux 内核更新至 5.14.6-3。
Partclone 更新至 0.3.18。
软件包 ezio 更新至 1.2.0。
语言文件 de_DE、hu_HU、es_ES、fr_FR、ja_JP、pl_PL、sk_SK、tr_TR 已更新。
改进了 ocs-live-netcfg 程序。
抑制了关于 "setterm -blank 0 "的错误信息。
增加缓存机制,以加快设备扫描的速度。
允许在 TUI 中使用保留的镜像名称,在 TUI 中显示关于保留镜像名称的描述。
在 recovery-iso-zip 模式下缺少选项 "-j2"。
Beginner 模式的保存菜单中没有显示 "-z9p"。
函数 get_not_busy_disks_or_parts:修复了一个 bug,它不能处理带有 /dev/mapper 的 dev。
不能从启动参数中搜索 live-media-path。
更多详情可查看此处

最新版本:3.0
2022年5月下旬发布的Clonezilla Live 3.0 更新内容包括:
底层的 GNU/Linux 操作系统进行了升级。该版本基于 Debian Sid 仓库(截至 2022 年 5 月 22 日)
Linux 内核更新至 5.17.6-1
Partclone 更新到了 0.3.20
该版本现在支持 APFS(苹果文件系统)镜像 / 克隆
增加了对 LUKS 的支持
更新德语、法语、葡萄牙语、日语等语言文件
在 Live 系统中添加 wavemon、memtester、edac-utils、shc 和 uml-utilities。
从 Live 系统中移除 s3ql
实施了一个更好的机制来检查磁盘的 GPT/MBR 格式
在 uEFI 启动菜单中添加 memtester
启动参数 use_os_prober="no" 现在可以跳过运行 os-prober
增加一个机制来跳过使用设备列表缓存。如果启动参数中的 use_dev_list_cache=no,那么就不会使用设备列表缓存机制

最新版本:3.1
Clonezilla Live 3.1 于2023年4月下旬正式发布,这个版本与 Debian Sid 存储库同步,并由 Linux 6.1.25 内核提供支持。新版本引入了两个新工具,dvtm(动态虚拟终端管理器)和 dtach,一个程序模拟屏幕的分离功能。还为 vgchange 命令引入了一个新的 “-K”( --ignoreactivationskip )选项以允许它处理快照,在 makeboot.sh 脚本中添加了对 x86 架构的支持,并在作为分区恢复时的图像。其他改动:
软件包 ezio 已更新至 2.0.1-1。
Memtest86+ 已更新至 v6.10。
如果 block dev 在恢复时发现镜像中有文件系统,则将其视为一个分区。
ocs-onthefly:如果 /dev/md* 存在,则禁用设备列表缓存机制。
ocs-sr:如果 /dev/md* 存在,则在 TUI 中列出磁盘和部件,并禁用设备列表缓存机制。
程序 makeboot.sh:使其仅在 x86 arch 中运行。

此外还有一些 bug fixed,更多详情可查看更新公告

官方主页:http://clonezilla.org/