硬盘分区备份与恢复工具-Partclone
2024-11-21 13:57:49 阿炯

Partclone 是一个开源用于备份磁盘的工具包,用于备份和恢复分区。它类似于著名的备份工具 "Partition Image",但设计用于更高的文件系统兼容性。Partclone 使用现有的e2fslibs库来读写分区,支持多种文件系统,如 ext2+, hfs+, reiserfs, reiser4, btrfs, vmfs3, vmfs5, xfs, jfs, ufs, ntfs, fat(12/16/32), exfat, f2fs, nilfs 等。采用C语言编写开发并在GPLv2许可协议下授权使用。


Partclone is a project similar to the well-known backup utility "Partition Image" a.k.a partimage. Partclone provides utilities to back up and restore used-blocks of a partition and it is designed for higher compatibility of the file system by using existing library.

Features


使用 Partclone

以下是一些基本的 Partclone 命令示例:

克隆分区到镜像文件
partclone.ext4 -d -c -s /dev/sda1 -o sda1.img

从镜像文件恢复分区
partclone.ext4 -d -r -s sda1.img -o /dev/sda1

分区到分区的克隆
partclone.ext4 -d -b -s /dev/sda1 -o /dev/sdb1

应用案例和最佳实践

备份系统分区

假设有一个安装了操作系统的分区 /dev/sda1,可以使用 Partclone 来备份这个分区:
partclone.ext4 -d -c -s /dev/sda1 -o /backup/sda1.img

恢复系统分区

在系统崩溃或需要重新安装系统时,可以使用备份的镜像文件来恢复分区:
partclone.ext4 -d -r -s /backup/sda1.img -o /dev/sda1

迁移系统到新硬盘

如果购买了新的硬盘并希望将系统迁移到新硬盘上,可以使用 Partclone 进行分区克隆:
partclone.ext4 -d -b -s /dev/sda1 -o /dev/sdb1



Usage

partclone.[ [fstype] | restore | dd | chkimg | info ]

All partclone utilities named prefix partclone.blabla... It's just like mkfs.[fstype] or mount.[fstype] and easy to remember. The list is our man pages made from xsltproc or just run man partclone to access manual from linux system.

partclone.[fstype]
The man page is for all utilities name with end of [xxx]fs, e.g. reiserfs. All file systems share the same options and features.

partclone.restore
The special man page for restore only.

partclone.dd
The special man page for partclone.dd only.

partclone.chkimg
The special man page for partclone.chkimg only.

partclone.info
The special man page for partclone.info only.


生态项目

Clonezilla
Clonezilla是一个开源的磁盘克隆和备份解决方案,它使用 Partclone 作为其核心组件之一。Clonezilla 可以用于大规模的系统部署、备份和恢复。

GParted
GParted是一个流行的分区编辑器,虽然它本身不使用 Partclone,但两者结合使用可以实现更强大的分区管理和备份功能。

最新版本:0.3
v0.3.32于2024年7月布。

项目主页:https://partclone.org/

https://github.com/Thomas-Tsai/partclone