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

 


Restoring the original filesystem on the smaller disk

 

1. to restore the image temporarily on a large disk,

2. use a filesystem resize tool (ntfsresize, resize2fs) to shrink the filesystem

3. Resizing the partition table, which GParted does, isn't necessary.

 


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

 

List partition

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(-b):

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

Clone By dd

# sda -> sdc

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

 


Runtime Gzip Image

 

Backup

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

Restore

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

 

 

 

Creative Commons license icon Creative Commons license icon