partclone

最後更新: 2017-10-13

前言

由於我重裝系統, 所以選用了 ext4 系統.

可恨用開的 partimage 不支援它 ............................

那唯有另覓工具

安裝:

  • Clonezilla
  • SystemRescueCD

它們都是集成了 partclone 的一身化的 liveCD 來 !!!

功能

 * back up and restore used-blocks of a partition
 * All backup blocks will be vertified by crc32 to make sure the data are correct.

應用

事前要看清楚它是否支援你的系統的 file system

Linux

  • Btrfs
  • Ext2, Ext3, and Ext4
  • Reiserfs
  • Reiser4
  • Xfs
  • Jfs

Windows

  • NTFS
  • FAT

 


Version

 

partclone.ntfs -v

Partclone : v0.2.58

 


Usage

 

指令

所有指令都如以 partclone.* 格式開頭, 常用的有

  • partclone.ntfs
  • partclone.extfs
  • partclone.restore
  • partclone.chkimg
  • partclone.dd
  • partclone.info

參數

-c, --clone                      建立 image 檔
-r, --restore                    還原 image
-b, --dev-to-dev             Device to Device

-o, --output FILE             當有 -b 時, 那 output 的地方就是 Device 了
-s, --source FILE

 


Example

 

parted -l

Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End    Size   File system  Name                          Flags
 1      1049kB  316MB  315MB  ntfs         Basic data partition          hidden, diag
 2      316MB   419MB  104MB  fat32        EFI system partition          boot
 3      419MB   554MB  134MB               Microsoft reserved partition  msftres
 4      554MB   385GB  385GB  ntfs         Basic data partition
 5      385GB   500GB  115GB  ntfs

 

Backup to Image:

partclone.extfs -c -s /dev/sda1 -o /mnt/backup/netbook_25-04-11.img

生成的 img 是並沒有被壓縮的 ~

  • -c,  --clone
  • -s,  --source FILE
  • -o,  --output FILE
  • -F,  --force    ( 無視 "ntfsclone-ng.c: NTFS Volume '/dev/sda4' is scheduled for a check or it was shutdown uncleanly.")

 

Clone HardDisk:

partclone.extfs  -b -s /dev/sda1 -o /dev/sdb1

# output

Partclone v0.2.16 http://partclone.org
Starting to back up device(/dev/sda1) to device(/dev/sdb1)
Elapsed: 00:00:04, Remaining: 00:00:00, Completed:100.00%,
Total Time: 00:00:04, 100.00%% completed!
File system:  NTFS
Device size:    8.6 GB
Space in use:   2.9 GB
Free Space:     5.7 GB
Block size:   4096 Byte
Used block :  701278
Elapsed: 00:04:44, Remaining: 00:00:00, Completed:100.00%, Rate: 606.85MB/min,
Total Time: 00:04:44, Ave. Rate:  606.9MB/min, 100.00%% completed!
Syncing... OK!
Partclone successfully cloned the device (/dev/sda1) to the device (/dev/sdb1)
Cloned successfully.

 

Check Image:

partclone.chkimg -s ./netbook_25-04-11.img

 

Restore:

!! 注意 !!   一按 Enter 它就會立即開始

partclone.extfs -r -s /mnt/backup/netbook_25-04-11.img -o /dev/sda1

OR

partclone.restore -s /mnt/backup/netbook_25-04-11.img -o /dev/sda1

Info:

partclone.info /home/backup/sdb2.img

 

Check:

# The utility to show image head information

partclone.chkimg /home/backup/sdb2.img

Opt:

-dlevel, --debug level     # Set the debug level [1|2|3]

Clone By dd

partclone.dd-b -s /dev/sda  -o /dev/sdc

 


Gzip Image

 

Backup

partclone.ext4 -c -s /dev/sda1 | gzip -c > ~/image_sda1.pcl.gz

Restore

zcat ~/image_sda1.pcl.gz | partclone.ext4 -r -o /dev/sda1